-
Notifications
You must be signed in to change notification settings - Fork 343
Closed
Description
All versions of Mono on non-Windows platforms are broken with respect to
DateTimeZoneProviders.Bcl.GetSystemDefault(), with the possible exception of
MonoDroid, which I can't check.
Because:
1. TimeZoneInfo.Local always provides a TimeZoneInfo with a fixed ID of "Local".
2. TimeZoneInfo.GetSystemTimeZones() does not actually contain a TimeZoneInfo
with ID "Local", and so calls to DateTimeZoneProviders.Bcl.GetSystemDefault()
will fail with e.g. "DateTimeZoneNotFoundException: Time zone Local is unknown
to source TimeZoneInfo: 3.5.0.0".
We could fix this by special-casing the local timezone in
BclDateTimeZoneSource, by making GetIds() unconditionally include
TimeZoneInfo.Local.Id.
Note that TimeZoneInfo.FindSystemTimeZoneById(TimeZoneInfo.Local.Id) _does_
work, so I believe that would be all that's needed.
[Note also that DateTimeZoneProviders.Tzdb.GetSystemDefault() will never work
on non-Windows Mono, as we have no CLDR mapping for a Windows time zone named
"Local".]
I'd like to explore taking this for 1.1.1, given that other fix in 1.1.1 is in
the same area. Jon: what do you think?
Original issue reported on code.google.com by malcolm.rowe on 31 Jul 2013 at 4:20