-
Notifications
You must be signed in to change notification settings - Fork 323
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
Specifying YYYY
instead of yyyy
in date format yields to parsing wrong year
#7461
Comments
Maybe we should attach a warning when Still, the current behaviour is plain incorrect. I assume we fall into the fallback that allows us to parse month+day combinations lacking the year - that's why the current year is put in as a 'default'. As we can see, in Java this format+date combination actually fails:
I think the same should happen for Enso. We need to process the formats in a smarter way and if the format contains more than just Month+Day parts, we cannot enter the fallback and replace the year with current one. I think we should also detect if there are any date parts that were specified in the format but not used in the final result (like As a side note, given that it is so easy to confuse |
The plan is to convert |
Initial notes but needs more thought and work. Following conversions would be useful I think: d/D - Day / Weekday name
HH:mm:ss.000000 (fractional sub seconds) Need something for WeekYear and DayOfYear. |
Radosław Waśko reports a new STANDUP for yesterday (2023-09-13): Progress: Clarifying spec and docs for date patterns. Implemented a tokenizer for date format, started work on parser. It should be finished by 2023-09-18. Next Day: Next day I will be working on the same task. Imlpement the parser and generate DateTimeFormatter. Work on dropdowns. |
Radosław Waśko reports a new STANDUP for yesterday (2023-09-14): Progress: Implemented new date format parsing. It should be finished by 2023-09-18. Next Day: Next day I will be working on the same task. Integrate with existing usage sites. Work on dropdowns. |
Radosław Waśko reports a new STANDUP for the provided date (2023-09-15): Progress: Integrated new format parsing with Date.parse/format. Preparing integration with other parts. Updated dropdowns - but failed to get them to display in the IDE - debugging. It should be finished by 2023-09-18. Next Day: Next day I will be working on the same task. Fix dropdowns. Integrate remaining parts. Add tests. |
Radosław Waśko reports a new 🔴 DELAY for yesterday (2023-09-18): Summary: There is 2 days delay in implementation of the Specifying Delay Cause: I did underestimate the amount of work. Debugging widgets was a bit slow since I did not have that much diagnsotic info so a lot of back and forth and iteration time is pretty big. But that's only part - other part is - simply a lot of stuff with this and I was slower than I originally anticipated. |
Radosław Waśko reports a new STANDUP for yesterday (2023-09-18): Progress: Fixed the dropdowns. Checked how the new format plays in practice with drodpowns. Got +- OK on the design so will continue. It should be finished by 2023-09-20. Next Day: Next day I will be working on the same task. Integrate with Data_Formatter and all other parts. Add tests. |
Radosław Waśko reports a new STANDUP for yesterday (2023-09-20): Progress: Integerated Data_Formatter and Column.format. All tests are finally passing. PR is ready for review. It should be finished by 2023-09-20. Next Day: Next day I will be working on the same task. Implement some further improvements. |
Radosław Waśko reports a new 🔴 DELAY for yesterday (2023-09-21): Summary: There is 1 days delay in implementation of the Specifying Delay Cause: I forgot about Column.format in previous estimations |
Radosław Waśko reports a new STANDUP for yesterday (2023-09-21): Progress: Applying review suggestions, getting some missing tests to pass. Testing new stuff (quarter parsing, week-date parsing). It should be finished by 2023-09-21. Next Day: Next day I will be working on the #7872 task. Implement some further improvements. |
- Closes #7461 by introducing a `Date_Time_Formatter` type and making parsing date time formats more robust and safer. - The default ('simple') set of patterns is slightly simplified and made case insensitive (except for `M/m` and `H/h`) to avoid the `YYYY` vs `yyyy` issues and make it less error prone. - The `YYYY` now has the same meaning as `yyyy` in simple mode. The old meaning (week-based year) is moved to a _separate mode_, triggered by `Date_Time_Formatter.from_iso_week_date_pattern`. - Full Java syntax, as well as custom-built Java `DateTimeFormatter` can also be used by `Date_Time_Formatter.from_java`. - Text-based constants (e.g. `ISO_ZONED_DATE_TIME`) have now become methods on `Date_Time_Formatter`, e.g. `Date_Time_Formatter.iso_zoned_date_time`).
Somehow if I specify
YYYY
in the date format, when parsing a date like03/01/2020
the date gets advanced into current year2023
.Actual behaviour
Expected behaviour
I know that the
Y
has a slightly different meaning in the Date format - meaning a week-year. But that still does not seem to make sense with the observed behaviour - changing the year as much as 3 years.Regardless, it is extremely easy to mistakenly use
Y
instead ofy
in the format (especially when we don't have dropdowns forTable.parse
yet). I think we need to make sure such mistakes are less likely to happen, as they are not that easy to detect and they lead to serious corruption of data that is not always very easy to notice.After observing that Java actually fails to parse this kind of date with that format string, I'm almost sure that Enso should error as well.
The text was updated successfully, but these errors were encountered: