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
Dates far the past using MM/dd/YYYY are displayed one year ahead #178
Comments
Does your database support saving values formatted with How can someone reproduce the issue you're having/seeing? |
I am using cakePHP to save them to a Microsoft SQL 2016 database, which is using the datatype of date – and requires the format to be YYYY-MM-DD. The saving is not the problem, I think it’s just a formatting issue. The problem can be reproduced by saving the date “12/31/1889” to a database using a generic “baked” cakePHP CRUD application. Then go to the “Edit” view, and the autofilled date is “12/31/1890” I can create one quickly on a MySQL database if you think Microsoft SQL is the culprit, but I think it has something to do with formatting since setting I should also clarify that it seems to be any date around the turn of the century or earlier, and near the end of the year. I haven't had enough time to figure out exactly when the cutoff might be - I thought I would open the issue here first. Let me know if there is something specific I can do to help. |
The format is wrong, please use |
Ok I stand corrected! Thank you for the help. |
I have noticed that when dates toward the turn of the century or before are displayed as MM/dd/YYYY, they appear incorrectly - one year ahead of where they should be. For example 12/31/1889 is saved to the database, and then rendered as 12/31/1890. Obviously this causes problems with CakePHPs edit views, where the values are automatically populated in form controls. Each time the user saves, the date is incremented ahead.
I noticed if I use
Cake\I18n\FrozenDate::setToStringFormat(\IntlDateFormatter::SHORT)
instead ofCake\I18n\FrozenDate::setToStringFormat('MM/dd/YYYY')
then the dates are displayed correctly.The text was updated successfully, but these errors were encountered: