talira

timezone (Dart)

The IANA time zone database and time zone aware DateTime for Dart

open sourceBSD-2-Clausefree

timezone is a Dart package, published by the Dart team (tools.dart.dev), that bundles the IANA time zone database and adds TZDateTime, a time zone aware DateTime, so a Dart or Flutter app can convert between zones and handle daylight saving time correctly. It ships three variants of the database: default (without most deprecated and historical zones), all, and 10y (five years back to five years ahead, about a quarter of the default's size), loaded from an embedded Dart library, in the browser, or from a file in standalone programs; tool/refresh.sh updates it to the latest IANA release. Finding the device's own time zone is out of its scope. It lives in dart-lang's labs repository.

Problems it solves

  • convert a DateTime to another time zone in my Flutter app
  • schedule notifications at a local time in a specific time zone in Dart
  • handle daylight saving time correctly in Dart

Features

  • the IANA time zone database bundled for Dart
  • TZDateTime, a time zone aware DateTime
  • default, all and 10-year database variants
  • loading for native, browser and standalone environments
  • a script to refresh to the latest IANA release

Limitations

  • Doesn't detect the device's current time zone, which its README says is platform dependent and not a goal.1