-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Exporting date values changes the year #40306
Labels
Milestone
Comments
We have seen the same issue with a BigQuery For reference:
Our BigQuery, PostgreSQL and server timezones are all set to UTC. |
adam-james-v
added a commit
that referenced
this issue
Mar 20, 2024
Fixes: #40306 Our datetime formatter relies on the `java-time.api`, for which there are many different, sometimes confusing, formatter patterns: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#appendPattern-java.lang.String- In this case, 'YYYY' is a week-of-year style year, which calculates which week a date falls into before returning the year. Sometimes days near the start/end of a year will fall into a week in the wrong year. For example, apparently 2023-12-31 falls into the 1st week of 2024, which probably not the year you'd expect to see. What we probably do want is 'yyyy' which calculates what day of the year the date is and then returns the year based off of that instead of the week number. For an explanation, you can check out this SO answer: https://stackoverflow.com/a/46395342 provides an explanation.
Closed
adam-james-v
added a commit
that referenced
this issue
Mar 21, 2024
Fixes: #40306 Our datetime formatter relies on the `java-time.api`, for which there are many different, sometimes confusing, formatter patterns: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#appendPattern-java.lang.String- In this case, 'YYYY' is a week-of-year style year, which calculates which week a date falls into before returning the year. Sometimes days near the start/end of a year will fall into a week in the wrong year. For example, apparently 2023-12-31 falls into the 1st week of 2024, which probably not the year you'd expect to see. What we probably do want is 'yyyy' which calculates what day of the year the date is and then returns the year based off of that instead of the week number. For an explanation, you can check out this SO answer: https://stackoverflow.com/a/46395342 provides an explanation.
github-actions bot
pushed a commit
that referenced
this issue
Mar 21, 2024
Fixes: #40306 Our datetime formatter relies on the `java-time.api`, for which there are many different, sometimes confusing, formatter patterns: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#appendPattern-java.lang.String- In this case, 'YYYY' is a week-of-year style year, which calculates which week a date falls into before returning the year. Sometimes days near the start/end of a year will fall into a week in the wrong year. For example, apparently 2023-12-31 falls into the 1st week of 2024, which probably not the year you'd expect to see. What we probably do want is 'yyyy' which calculates what day of the year the date is and then returns the year based off of that instead of the week number. For an explanation, you can check out this SO answer: https://stackoverflow.com/a/46395342 provides an explanation.
metabase-bot bot
added a commit
that referenced
this issue
Mar 21, 2024
#40450) Fixes: #40306 Our datetime formatter relies on the `java-time.api`, for which there are many different, sometimes confusing, formatter patterns: https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html#appendPattern-java.lang.String- In this case, 'YYYY' is a week-of-year style year, which calculates which week a date falls into before returning the year. Sometimes days near the start/end of a year will fall into a week in the wrong year. For example, apparently 2023-12-31 falls into the 1st week of 2024, which probably not the year you'd expect to see. What we probably do want is 'yyyy' which calculates what day of the year the date is and then returns the year based off of that instead of the week number. For an explanation, you can check out this SO answer: https://stackoverflow.com/a/46395342 provides an explanation. Co-authored-by: adam-james <21064735+adam-james-v@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Describe the bug
Error notced after metabase update to 0.49.0.
When exporting a report with a date of 12/31/2023 (in short format 'M/D/YYYY') to .csv or .json the year gets exported as 2024.
Oddly, the same error does not occur for 12/31/2022.
To Reproduce
SELECT TO_DATE('20231231', 'YYYYMMDD')
Expected behavior
To export the date with the accurate year.
Logs
No response
Information about your Metabase installation
Severity
impacting our data integrity
Additional context
No response
The text was updated successfully, but these errors were encountered: