uic-location-timezone
Version:
Get timezone information for a given UIC location code.
41 lines (29 loc) • 1.94 kB
Markdown
# uic-location-timezone
Get timezone information for a given [UIC location code (ENEE)](https://uic.org/location-codes-enee) based on its country, if the country has a unique timezone.
[](https://www.npmjs.com/package/uic-location-timezone)
[](https://travis-ci.org/juliuste/uic-location-timezone)
[](https://greenkeeper.io/)
[](https://david-dm.org/juliuste/uic-location-timezone)
[](license)
[](https://gitter.im/juliuste)
## Installation
```bash
npm install uic-location-timezone
```
## Usage
Note that the given UIC location code must be deemed valid by [`is-uic-location-code`](https://github.com/juliuste/is-uic-location-code), otherwise an Error will be thrown.
```js
const uicLocationTimezone = require('is-uic-location-code')
uicLocationTimezone('1000010') // 'Europe/Helsinki'
uicLocationTimezone('7300003') // 'Europe/Athens'
uicLocationTimezone('8000001') // null (yes, Germany has two timezones… https://en.wikipedia.org/wiki/Time_in_Germany#IANA_time_zone_database)
uicLocationTimezone('4200012') // 'Asia/Tokyo'
uicLocationTimezone('9000100') // 'Africa/Cairo'
uicLocationTimezone('2000001') // null (Russia)
uicLocationTimezone('80-00001') // throws
uicLocationTimezone(8777777) // throws
uicLocationTimezone('800000001') // throws
uicLocationTimezone(null) // throws
```
## Contributing
If you found a bug or want to propose a feature, feel free to visit [the issues page](https://github.com/juliuste/uic-location-timezone/issues).