defaultPlatformTimezoneProvider function
The default platform timezone provider.
Supported & tested platforms:
- Windows - Windows 11 & Windows Server 2022
- MacOS - MacOS 13
- Linux - Ubuntu 22.04
- Web - Latest stable versions of Chrome & Firefox
Implementation details
Retrieval of timezones is performed on a best-effort basis. There is no guarantee that the actual timezone is returned.
Factory
is always returned on unsupported
platforms.
We're waiting for the following to become stable before supporting Android & iOS:
- https://github.com/dart-lang/sdk/issues/49673
- https://github.com/dart-lang/sdk/issues/49674
- https://github.com/dart-lang/sdk/issues/50565
MacOS & Linux caveats
MacOS and Linux will use the TZ
environment if set to a TZ database timezone identifier such as Asia/Singapore
.
Since the TZ
environment variable format is complicated and varies across distros, it is otherwise ignored.
Subsequently, the /etc/localtime
symbolic link is resolved. Most mainstream distros such as Ubuntu and Debian
has this symbolic link.
Web caveats
Web uses Javascript's Intl.DateFormat().resolvedOptions().timeZone
.
Some obsolete browsers such as IE 11, do not support it.
See the following pages on browser compatibility:
Implementation
String defaultPlatformTimezoneProvider() => provider();