-
- Downloads
Formatter Gives correct year for dates near start/end of Year (#40410) (#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>
Please register or sign in to comment