timezone 0.1.0 copy "timezone: ^0.1.0" to clipboard
timezone: ^0.1.0 copied to clipboard

outdated

Library to convert DateTimes between Time Zones.

TimeZone #

Library to convert date times between TimeZones.

The data for Time Zones are from [http://www.iana.org/time-zones](the IANA Time Zone Database).

Initialization #

TimeZone objects require time zone data, so the first step is to load the data.

We are providing two different APIs for browsers and servers.

Initialization for browser environment #

Import package:timezone/browser.dart library and run async function initializeTimeZone([String url]).

This function has optional argument with the path to the data url.

import 'package:timezone/browser.dart';

tz.initializeTimeZone()
.then((_) {

  final detroit = getLocation('America/Detroit');
  final now = new TZDateTime.now(detroit);

});

Initialization for server environment #

Import package:timezone/server.dart library and run async function initializeTimeZone().

import 'package:timezone/server.dart';

tz.initializeTimeZone()
.then((_) {

  final detroit = getLocation('America/Detroit');
  final now = new TZDateTime.now(detroit);

});

API #

Location #

final detroit = getLocation('America/Detroit');

TimeZone #

TimeZone object represents time zone and contains offset and name in abbreviated form.

TimeZone aware DateTime #

TZDateTime object implements standard DateTime interface and contains information about the time zone.

final date = new TZDateTime(detroit, 2014, 11, 17);

Updating Time Zone database #

$ pub run tool/get -s 2014h
383
likes
0
pub points
99%
popularity

Publisher

unverified uploader

Library to convert DateTimes between Time Zones.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

collection, tuple

More

Packages that depend on timezone