Closed chrisimcevoy closed 4 months ago
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 95.48%. Comparing base (
e43afe4
) to head (49a48de
). Report is 25 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
While implementing #156, I noticed something was amiss with
LocaleDateTime
. For my locale (en-GB), I should see the date in the formatdd/MM/yyyy
, but what I actually saw in the REPL was:Looking into it, I discovered that
CultureInfo.current_culture.date_time_format.short_date_pattern
was giving meM/d/yyyy
instead ofdd/MM/yyyy
.This was made more confusing by the fact that if I constructed a
CultureInfo
manually, it gave me the right short date format:After a bit more investigation, I discovered that the root cause lay in
CultureInfo._get_default_locale_name()
, which was returningen_GB
(underscore) rather thanen-GB
(hyphen). Verified via:This in itself was perplexing as I would have expected both
"en-GB"
and"en_GB"
to result in Cultures with the same short date format. I went hunting in dotnet to get some answers... This test passes:So the take-aways here are:
CultureInfo._get_default_locale_name()
which for me was returning"en_GB"
(ICU locale name) rather than"en-GB"
(dotnet style culture name)."en_GB"
and"en-GB"
cultures having different short date formats; Or at least, we are bug-for-bug compatible with dotnet in this regard.Oh, and after patching this up, here is what I get in my REPL: