datetimeformatter: DateTimeFormatter cheat sheet module (pattern letters incl. the four hour letters, yyyy vs YYYY week-year bug and WeekFields, en_IN locales and the U+202F AM/PM trap with parseLenient fix, SMART/STRICT/LENIENT parsing, ISO constants, SimpleDateFormat thread safety), 18 contract tests
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_017ic4b3fvyFpxThdRxcozLx
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
== one date, two letters ==
|
||||
date = 2026-12-29 (TUESDAY)
|
||||
dd-MM-yyyy = 29-12-2026
|
||||
dd-MM-YYYY = 29-12-2027
|
||||
|
||||
== the same YYYY pattern, four locales, three dates ==
|
||||
date en_US en_GB fr_FR en_IN
|
||||
2026-12-28 2027 2026 2026 2027
|
||||
2026-12-29 2027 2026 2026 2027
|
||||
2027-01-01 2027 2026 2026 2027
|
||||
|
||||
== why: each locale defines what a week is (WeekFields) ==
|
||||
en_US WeekFields[SUNDAY,1] week-based-year of 2026-12-29 = 2027, week number = 1
|
||||
en_GB WeekFields[MONDAY,4] week-based-year of 2026-12-29 = 2026, week number = 53
|
||||
fr_FR WeekFields[MONDAY,4] week-based-year of 2026-12-29 = 2026, week number = 53
|
||||
en_IN WeekFields[SUNDAY,1] week-based-year of 2026-12-29 = 2027, week number = 1
|
||||
|
||||
== how often is YYYY wrong? every day of 2020-2030, compared with yyyy ==
|
||||
en_US 36 wrong days out of 4018
|
||||
en_GB 19 wrong days out of 4018
|
||||
fr_FR 19 wrong days out of 4018
|
||||
en_IN 36 wrong days out of 4018
|
||||
|
||||
== the days that are wrong in the US locale ==
|
||||
2024/2025: 2024-12-29->2025, 2024-12-30->2025, 2024-12-31->2025
|
||||
2025/2026: 2025-12-28->2026, 2025-12-29->2026, 2025-12-30->2026, 2025-12-31->2026
|
||||
2026/2027: 2026-12-27->2027, 2026-12-28->2027, 2026-12-29->2027, 2026-12-30->2027, 2026-12-31->2027
|
||||
2027/2028: 2027-12-26->2028, 2027-12-27->2028, 2027-12-28->2028, 2027-12-29->2028, 2027-12-30->2028, 2027-12-31->2028
|
||||
2028/2029: 2028-12-31->2029
|
||||
|
||||
== yyyy vs uuuu: same for modern dates, different for the era ==
|
||||
date = -0043-03-15
|
||||
yyyy = 0044
|
||||
uuuu = -0043
|
||||
yyyy G = 0044 BC
|
||||
Reference in New Issue
Block a user