Skip to content

On the mingw64 target, use a fixed-offset timezone name if the user disabled DST transitions #575

@dkhalanskyjb

Description

@dkhalanskyjb

On Windows, there's an option to disable daylight saving time transitions. People actually use this functionality.

In our current implementation, we do support this, but in a non-intuitive manner: if the flag is enabled, TimeZone.currentSystemDefault() returns a timezone that has the name that the user has chosen, but the behavior of a fixed-offset timezone. For example, you could receive Europe/Berlin that behaved as if it had the constant UTC offset of +01:00.

Java has solved this problem differently, and in my opinion, much more elegantly: it returns a normal, valid fixed-offset timezone with that offset.

Examples:

  • W. Europe Standard Time, DST is enabled → Europe/Berlin
  • W. Europe Standard Time, DST is disabled → GMT+01:00
  • GMT Standard Time, DST is enabled → Europe/London
  • GMT Standard Time, DST is disabled → GMT

I believe we should implement the same logic. both simplifying our conceptual model and avoiding a surprising behavior where two timezones called Europe/Berlin would behave differently from one another. It does lose some information that the user provided (that is, which exact timezone is being used), but given the use case for disabling the DST transitions, this doesn't seem significant.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions