Skip to content

Commit

Permalink
Add $sectionValue->presentValue() for date formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
joostfaassen committed Jan 11, 2017
1 parent 5359134 commit 712be11
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/Model/SectionValue.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,25 @@ public function setRepeat($repeat)
$this->repeat = $repeat;
return $this;
}

protected function isStamp()
{
if (!is_numeric($this->value)) {
return false;
}
if (strpos(strtolower($this->label), 'datum')!== false) {
return true;
}
return false;
}

public function presentValue()
{
$value = $this->getValue();
$value = nl2br($value);
if ($this->isStamp()) {
$value = date('d-m-Y', $value);
}
return $value;
}
}

0 comments on commit 712be11

Please sign in to comment.