Skip to content

Commit 9da9477

Browse files
committed
fix(datefield): change event and comparison
1 parent a959839 commit 9da9477

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

inc/field/datefield.class.php

+4
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ public function equals($value): bool {
147147
$answer = $this->value;
148148
}
149149
$answerDatetime = DateTime::createFromFormat(self::DATE_FORMAT, $answer);
150+
$answerDatetime->setTime(0,0,0,0);
150151
$compareDatetime = DateTime::createFromFormat(self::DATE_FORMAT, $value);
152+
$compareDatetime->setTime(0,0,0,0);
151153
return $answerDatetime == $compareDatetime;
152154
}
153155

@@ -162,7 +164,9 @@ public function greaterThan($value): bool {
162164
$answer = $this->value;
163165
}
164166
$answerDatetime = DateTime::createFromFormat(self::DATE_FORMAT, $answer);
167+
$answerDatetime->setTime(0,0,0,0);
165168
$compareDatetime = DateTime::createFromFormat(self::DATE_FORMAT, $value);
169+
$compareDatetime->setTime(0,0,0,0);
166170
return $answerDatetime > $compareDatetime;
167171
}
168172

js/scripts.js

+1-4
Original file line numberDiff line numberDiff line change
@@ -1673,13 +1673,10 @@ function pluginFormcreatorInitializeCheckboxes(fieldName, rand) {
16731673
* Initialize a date field
16741674
*/
16751675
function pluginFormcreatorInitializeDate(fieldName, rand) {
1676-
var field = $('[name="_' + fieldName + '"]');
1676+
var field = $('[name="' + fieldName + '"]');
16771677
field.on("change", function() {
16781678
plugin_formcreator.showFields($(field[0].form));
16791679
});
1680-
$('#resetdate' + rand).on("click", function() {
1681-
plugin_formcreator.showFields($(field[0].form));
1682-
});
16831680
}
16841681

16851682
/**

0 commit comments

Comments
 (0)