win2iana_tz_converter 0.1.2 copy "win2iana_tz_converter: ^0.1.2" to clipboard
win2iana_tz_converter: ^0.1.2 copied to clipboard

A lightweight package used for converting between Windows time zones and IANA time zone database format.

example/main.dart

import 'package:win2iana_tz_converter/win2iana_tz_converter.dart';

void defaultConverter() {
  print('[normal]------------------------');
  final TZConverter ct = TZConverter();
  final win2ianaResult =
      ct.windowsToIana("China Standard Time").map((e) => e.toJson()).toList();
  print("win2iana: $win2ianaResult");
  final iana2winResult =
      ct.ianaToWindws("Asia/Hong_Kong").map((e) => e.toJson()).toList();
  print('iana2win: $iana2winResult');
}

void converterWithCache() {
  print('[cache]------------------------');
  final TzConverterWithCache ct = TZConverter.cache();
  final win2ianaResult =
      ct.windowsToIana("China Standard Time").map((e) => e.toJson()).toList();
  print("win2iana: $win2ianaResult");
  final iana2winResult =
      ct.ianaToWindws("Asia/Hong_Kong").map((e) => e.toJson()).toList();
  print('iana2win: $iana2winResult');
}

void convertCustomDB() {
  final db = {
    "supplemental": {
      "version": {"_unicodeVersion": "15.1.0", "_cldrVersion": "45"},
      "windowsZones": {
        "mapTimezones": [
          {
            "mapZone": {
              "_other": "Afghanistan Standard Time",
              "_type": "Asia/Kabul",
              "_territory": "001"
            }
          },
        ]
      }
    }
  };
  print('[custom_db]------------------------');
  print('db: $db');
  final TZConverter ct = TZConverter(db: db);
  final win2ianaResult =
      ct.windowsToIana("China Standard Time").map((e) => e.toJson()).toList();
  print("win2iana: $win2ianaResult");
  final iana2winResult =
      ct.ianaToWindws("Asia/Kabul").map((e) => e.toJson()).toList();
  print('iana2win: $iana2winResult');
}

void main() {
  defaultConverter();
  converterWithCache();
  convertCustomDB();
}
2
likes
160
points
637
downloads

Publisher

unverified uploader

Weekly Downloads

A lightweight package used for converting between Windows time zones and IANA time zone database format.

Repository (GitHub)
View/report issues

Topics

#converter #timezone #iana

Documentation

API reference

Funding

Consider supporting this project:

www.buymeacoffee.com

License

LGPL-3.0 (license)

More

Packages that depend on win2iana_tz_converter