Skip to content

Commit

Permalink
fix(date): format dates for target generation
Browse files Browse the repository at this point in the history
fix #1050

Signed-off-by: btry <tbugier@teclib.com>
  • Loading branch information
btry committed Sep 26, 2018
1 parent 1ac0e07 commit ed32016
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions inc/fields/datefield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ public function getValue() {
return (strtotime($date) != '') ? $date : null;
}

public function prepareQuestionInputForTarget($input) {
return Toolbox::addslashes_deep(Html::convDate($input));
}

public function getAnswer() {
return Html::convDate($this->getValue());
}
Expand Down
4 changes: 4 additions & 0 deletions inc/fields/datetimefield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ public function getAnswer() {
return Html::convDateTime($this->getValue());
}

public function prepareQuestionInputForTarget($input) {
return Toolbox::addslashes_deep(Html::convDateTime($input));
}

public function isValid($value) {
// If the field is required it can't be empty
if ($this->isRequired() && (strtotime($value) == '')) {
Expand Down

0 comments on commit ed32016

Please sign in to comment.