Skip to main content

timezone_extensions 0.2.0 copy "timezone_extensions: ^0.2.0" to clipboard
timezone_extensions: ^0.2.0 copied to clipboard

Add-on for package:timezone — convert a TZDateTime from one Location to another, and look up English generic, standard, and daylight zone names.

example/example.dart

import 'package:timezone/data/latest_all.dart' as tz;
import 'package:timezone/timezone.dart';
import 'package:timezone_extensions/timezone_extensions.dart';

void main() {
  tz.initializeTimeZones();

  final paris = getLocation('Europe/Paris');
  final newYork = getLocation('America/New_York');

  print('${paris.name} → ${paris.timeZoneGenericName}');
  // Europe/Paris → Central European Time
  print('${newYork.name} → ${newYork.timeZoneGenericName}');
  // America/New_York → Eastern Time

  final takeOff = TZDateTime(paris, 2026, 8, 23, 10, 15);

  print(takeOff); // 2026-08-23 10:15:00.000+0200
  print(takeOff.timeZoneSpecificName); // Central European Summer Time
  print(takeOff.utcOffsetLabel); // UTC+02

  final flightDuration = Duration(hours: 8, minutes: 30);
  final arrival = takeOff.add(flightDuration).toLocation(newYork);

  print(arrival); // 2026-08-23 12:45:00.000-0400
  print(arrival.timeZoneSpecificName); // Eastern Daylight Time
  print(arrival.utcOffsetLabel); // UTC-04

  print('Unicode CLDR: $cldrVersion');
}
0
likes
160
points
825
downloads

Documentation

API reference

Publisher

verified publisherg.watch

Weekly Downloads

Add-on for package:timezone — convert a TZDateTime from one Location to another, and look up English generic, standard, and daylight zone names.

Repository (GitHub)
View/report issues

Topics

#timezone #iana

License

MIT (license)

Dependencies

timezone

More

Packages that depend on timezone_extensions