File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4242class DateField extends DatetimeField
4343{
4444 const DATE_FORMAT = 'Y-m-d ' ;
45+ const DATE_ZERO = '0000-00-00 ' ;
4546
4647 public function getRenderedHtml ($ domain , $ canEdit = true ): string {
4748 if (!$ canEdit ) {
@@ -77,7 +78,7 @@ public static function getName(): string {
7778 */
7879 protected function getDateFromValue (string $ value ) {
7980 if (empty ($ value )) {
80- $ value = ' 0000-00-00 ' ;
81+ $ value = self :: DATE_ZERO ;
8182 }
8283 $ datetime = DateTime::createFromFormat (self ::DATE_FORMAT , $ value );
8384 if ($ datetime !== false ) {
Original file line number Diff line number Diff line change @@ -46,6 +46,7 @@ class DatetimeField extends PluginFormcreatorAbstractField
4646 protected $ fields = null ;
4747
4848 const DATE_FORMAT = 'Y-m-d H:i:s ' ;
49+ const DATE_ZERO = '0000-00-00 00:00:00 ' ;
4950
5051 public function isPrerequisites (): bool {
5152 return true ;
@@ -151,7 +152,7 @@ public static function canRequire(): bool {
151152 */
152153 protected function getDateFromValue (string $ value ) {
153154 if (empty ($ value )) {
154- $ value = ' 0000-00-00 00:00:00 ' ;
155+ $ value = self :: DATE_ZERO ;
155156 }
156157 return DateTime::createFromFormat (self ::DATE_FORMAT , $ value );
157158 }
You can’t perform that action at this time.
0 commit comments