0 purchases
win2iana tz converter
Win2IANA TZ Converter #
win2iana_tz_converter is a lightweight package which used for converting
between Windows time zones and IANA time zone database format.
Features #
Including a built-in set of Windows to IANA conversion data for convenient
direct use. And also provided a simple cache version implementation.
final TZConverter ct1 = TZConverter();
final TzConverterWithCache ct2 = TZConverter.cache();
final TzConverterWithCache ct3 = TZConverter.cacheWithParent(ct1);
copied to clipboard
You can also customize a set of data for conversion.
Data format can be viewed here.
final db = {
"supplemental": {
"version": {"_unicodeVersion": "15.1.0", "_cldrVersion": "45"},
"windowsZones": {
"mapTimezones": [
{
"mapZone": {
"_other": "Afghanistan Standard Time",
"_type": "Asia/Kabul",
"_territory": "001"
}
},
// other mapZone
]
}
}
};
final TZConverter ct1 = TZConverter(db: db);
final TzConverterWithCache ct2 = TZConverter.cache(db: db);
copied to clipboard
Getting started #
Add dependency with dart pub add command #
dart pub add win2iana_tz_converter
copied to clipboard
Or Add below line to pubspec.yaml #
dependencies:
...
win2iana_tz_converter: any # or special version
copied to clipboard
Then run dart pub get, or flutter pub get for flutter project.
Usage #
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');
copied to clipboard
for more example see: tz_converter_example.dart
Donate #
License #
Copyright (C) 2024 Fries_I23
win2iana_tz_converter is free software: you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
win2iana_tz_converter is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with win2iana_tz_converter. If not, see <https://www.gnu.org/licenses/>.
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.