Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 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 #364

Open
1 task done
rossaddison opened this issue Oct 2, 2022 · 3 comments
Assignees
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug

Comments

@rossaddison
Copy link

rossaddison commented Oct 2, 2022

No duplicates 🥲.

  • 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

@rossaddison rossaddison added status:to be verified Needs to be reproduced and validated. type:bug Bug labels Oct 2, 2022
@rossaddison
Copy link
Author

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()))

@rossaddison rossaddison changed the title 🐛 Dummy mysql date ie. '0000-00-00' in date column, running sqlmode="" (ie. not strict mode), is presented as -0001-11-30 🐛 Minor issue: Dummy mysql date ie. '0000-00-00' in date column, running sqlmode="" (ie. not strict mode), is presented as -0001-11-30 Oct 2, 2022
@rossaddison
Copy link
Author

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 ...

@rossaddison rossaddison changed the title 🐛 Minor issue: Dummy mysql date ie. '0000-00-00' in date column, running sqlmode="" (ie. not strict mode), is presented as -0001-11-30 🐛 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 Oct 2, 2022
@roxblnfk roxblnfk added this to Cycle Oct 2, 2022
@roxblnfk roxblnfk moved this to Discuss in Cycle Oct 2, 2022
@roxblnfk
Copy link
Member

roxblnfk commented Oct 2, 2022

are you sure the problem is not about timezone?

@roxblnfk roxblnfk moved this from Discuss to Backlog in Cycle Sep 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:to be verified Needs to be reproduced and validated. type:bug Bug
Projects
Status: Backlog
Development

No branches or pull requests

2 participants