@h6you/timezone-names-cn

1.0.6 • Public • Published

Simple key-value map from IANA timezone names (in English) to Chinese and also the other way around.

All english timezone names (over 500) are taken from moment-timezone (and therefore should work with most of the time conversion tools). The Chinese translation is generated by soimort/translate-shell and edited by me. If you find a translation error, please let me know so I can fix it.

The UTC/GMT offset values are not included in the map for simplicity, but an utility function utcOffset is provided for calculating the current offset on the fly.

Usage

import { cn, en, utcOffset } from '@h6you/timezone-names-cn'

console.log(cn['America/Toronto']) // 美洲/多伦多
console.log(en['美洲/多伦多']) // America/Toronto

const offsetMinitesSH = utcOffset('Asia/Shanghai')
console.log(offsetMinitesSH) // 480

const offsetMinitesTO = utcOffset('America/Toronto')
console.log(offsetMinitesTO) // -300 during EST and -240 during EDT

Readme

Keywords

Package Sidebar

Install

npm i @h6you/timezone-names-cn

Weekly Downloads

5

Version

1.0.6

License

ISC

Unpacked Size

49.3 kB

Total Files

5

Last publish

Collaborators

  • h6you