0.0.1 • Published 7 years ago

@picter/timezones v0.0.1

Weekly downloads
30
License
MIT
Repository
-
Last release
7 years ago

Timezones

This project uses moment-timezone's data utitlities to create compact but comprehensive lists of timezones for user interfaces.

Usage

import timezones from '@picter/timezones/data/select-list.json';
import moment from 'moment-timezone';
import momentData from '@picter/timezones/data/moment-timezones.json';

console.log(JSON.stringify(timezones, null, 2));

/*
output:

[
  {
    "label": "(UTC-11:00) Niue",
    "value": "Pacific/Niue"
  },
  {
    "label": "(UTC-11:00) Pago Pago, Midway, Samoa",
    "value": "Pacific/Pago_Pago"
  },
...
]

*/

// use pre-built moment data to base moment on the same data
moment.tz.add(momentData.zones);

The values are extracted from iana's time zone database and can safely be used by libraries like moment-timezone.

Development

iana publishes database updates twice a year. As soon as moment-timezone updated their data, we can update our moment-timezone dev-dependency and rebuild or lists with yarn run build.