π Minor issue: Zero/Dummy mysql date ie. '0000-00-00' in date column, running sqlmode="" (ie. not strict mode), is presented as -0001-11-30
No duplicates π₯².
- [X] I have searched for a similar issue in our bug tracker and didn't find any solutions.
What happened?
The date on the view is in the format:
eg. ($client->getClient_birthdate())->format(....users...date...format....choice...eg. 'Y-m-d');
ie. DateTimeImmutable date with the format command.
Version
ORM 2.0.0
PHP 8.1.9
The date was presented as -0001-11-30 as a string
I can avoid this issue completely if I simply present the current date on the client form. In this way the user will have to edit the current date to their birthdate. This ensures that an official date is entered in the column. Or I can do something like this in the view:
eg.
(($client->getClient_birthdate())->format($datehelper->style())) === '-0001-11-30' ? 'Please fill in your birthdate'
:
(($client->getClient_birthdate())->format($datehelper->style()))
This is the mySql documentation:
5.1.11 Server SQL Modes https://dev.mysql.com/doc/refman/8.0/en/sql-mode.html With strict mode disabled, invalid dates such as '2004-04-31' are converted to '0000-00-00' and a warning is generated. NO_ZERO_DATE The NO_ZERO_DATE mode affects whether the server permits '0000-00-00' as a valid date. If this mode is not enabled, ... The MySQL server can operate in different SQL modes, and can apply these modes differently for different clients, depending on the value of the sql_mode system ... B.3.4.2 Problems Using DATE Columns https://dev.mysql.com/doc/refman/8.0/en/using-date.html The special βzeroβ date '0000-00-00' can be stored and retrieved as '0000-00-00'. When a '0000-00-00' date is used through Connector/ODBC, it is automatically converted to NULL because ODBC cannot handle that kind of date. MySQL permits you to ...You should use this format in UPDATE expressions and in the WHERE clause of SELECT ...
are you sure the problem is not about timezone?