Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

moment-timezone

moment43.3mMIT0.5.47TypeScript support: included

Parse and display moments in any timezone.

moment, date, time, timezone, olson, iana, zone, tz

readme

Moment Timezone

NPM version NPM downloads MIT License Build Status FOSSA Status

IANA Time zone support for Moment.js

Project Status

Moment-Timezone is an add-on for Moment.js. Both are considered legacy projects, now in maintenance mode. In most cases, you should choose a different library.

For more details and recommendations, please see Project Status in the Moment docs.

Thank you.

Resources

Examples

var june = moment("2014-06-01T12:00:00Z");
june.tz('America/Los_Angeles').format('ha z'); // 5am PDT
june.tz('America/New_York').format('ha z');    // 8am EDT
june.tz('Asia/Tokyo').format('ha z');          // 9pm JST
june.tz('Australia/Sydney').format('ha z');    // 10pm EST

var dec = moment("2014-12-01T12:00:00Z");
dec.tz('America/Los_Angeles').format('ha z');  // 4am PST
dec.tz('America/New_York').format('ha z');     // 7am EST
dec.tz('Asia/Tokyo').format('ha z');           // 9pm JST
dec.tz('Australia/Sydney').format('ha z');     // 11pm EST

License

Moment-timezone is freely distributable under the terms of the MIT license.

FOSSA Status

changelog

0.5.47 2025-01-28

  • Updated data to IANA TZDB 2025a.

0.5.46 2024-10-06

  • Updated data to IANA TZDB 2024b. This only affects historical timestamps; no future timestamps have changed.

0.5.45 2024-02-04

  • Updated data to IANA TZDB 2024a.

0.5.44 2023-12-29

  • Updated data to IANA TZDB 2023d.
  • Fixed .valueOf() to return NaN for invalid zoned objects (matching default moment) #1082.
  • Performance improvements:
    • Use binary search when looking up zone information #720.
    • Avoid redundant checks in tz.guess().
    • Avoid redundant getZone() calls in .tz().

0.5.43 2023-03-31

  • Updated data to IANA TZDB 2023c

0.5.42 2023-03-24

  • Updated data to IANA TZDB 2023b

0.5.41 2023-02-25

  • Updated moment npm dependency to 2.29.4 to remove automated warnings about insecure dependencies. Moment Timezone still works with core Moment 2.9.0 and higher.
  • Updated all dev dependencies including UglifyJS, which produces the minified builds.
  • Added deprecation warning to the pre-built moment-timezone-with-data-2012-2022 bundles #1035. Use the rolling moment-timezone-with-data-10-year-range files instead.

0.5.40 2022-12-11

  • Updated data to IANA TZDB 2022g

0.5.39 2022-11-13

  • Updated data to IANA TZDB 2022f

0.5.38 2022-10-15

  • Updated data to IANA TZDB 2022e
  • Added moment.tz.dataVersion property to TypeScript definitions #930
  • Removed temporary .tar.gz files from npm releases #1000

0.5.37 2022-08-25

0.5.36 2022-08-25

  • IANA TZDB 2022c
  • improvements/fixes to data pipeline

0.5.35 2022-08-23

Thanks to the OpenSSF Alpha-Omega project for reporting these!

0.5.34 2021-11-10

  • Updated data to IANA TZDB 2021e

0.5.33 2021-02-06

  • Updated data to IANA TZDB 2021a

0.5.32 2020-11-14

  • Updated data to IANA TZDB 2020d

0.5.31 2020-05-16

  • Fixed Travis builds for Node.js 4 and 6

0.5.30 2020-05-16

  • Updated data to IANA TZDB 2020a
  • Fixed typescript definitions

NOTE: You might need to un-install @types/moment-timezone. Check https://github.com/moment/moment-timezone/issues/858 for more info

0.5.29 2020-05-16

0.5.28 2020-02-21

Merged pull request #410 from @adgrace:

  • Added a method moment.tz.zonesForCountry(country_code) which returns all timezones for the country
  • Added a method moment.tz(timezone_id).countries() to get countries for some time zone
  • Added a method moment.tz.countries() to get all country codes
  • And as you know moment.tz.zones() already exists

0.5.27 2019-10-14

  • Updated data to IANA TZDB 2019c

0.5.26 2019-06-06

  • Updated data to IANA TZDB 2019b
  • Fix: stabilize Array.sort #762

0.5.25 2019-04-17

  • Fix moment.tz.dataVersion to return 2019a #742
  • Update path in bower.json

0.5.24 2019-04-17

  • Updated data to IANA TZDB 2019a #737
  • Start shipping both a 1970-1930 file and a rolling 10-year file #614 #697
  • Fixed bug where _z time zone name was not cleared with .local() or .utcOffset(offset) #738

0.5.23 2018-10-28

  • Fix minor issue with tz guessing in Russia #691

0.5.22 2018-10-28

  • Updated data to IANA TZDB 2018g #689
  • Fix issue with missing LMT entries for some zones, and fix data builds on Linux and Windows #308

0.5.21 2018-06-23

  • Bugfix: revert breaking change introduced in 0.5.18

0.5.20 2018-06-18

  • Bugfix: accidentally commented code

0.5.19 2018-06-18

  • Revert: moved moment to peerDependencies

0.5.18 2018-06-18

  • Return error when timezone name is not a string.
  • Moved moment to peerDependencies #628
  • Prefer nodejs to amd declaration #573

0.5.17 2018-05-12

  • Updated data to IANA TZDB 2018d. #616

0.5.16 2018-04-18

  • Fixed Etc/UTC timezone recognition, updated tests. #599
  • Updated minified files to contain IANA TZDB 2018d data

0.5.15 2018-04-17

  • Updated data to IANA TZDB 2018d. #596

0.5.14 2017-10-30

  • Ensure Intl response is valid when guessing time zone. #553
  • Updated data to IANA TZDB 2017c. #552
  • Convert to tz keeping wall time #505
  • Make all time zones available for guessing. #483
  • zone.offset has been deprecated in favor of zone.utcOffset #398
  • Check for timestamp formats when parsing #348

0.5.13 2017-04-04

  • Bumped version to address Bower cache issues with last release. #474
  • (No actual changes otherwise)

0.5.12 2017-04-02

  • Updated data to IANA TZDB 2017b. #422
  • Build the truncated data file as 2012-2022 (+/- 5 years).

0.5.11 2016-12-23

  • Remove log statement when data is loaded twice. #352

0.5.10 2016-11-27

  • Updated data to IANA TZDB 2016j. #422

0.5.9 2016-11-03

  • Fixed the output of moment.tz.version. #413

0.5.8 2016-11-03

  • Updated data to IANA TZDB 2016i. #411

0.5.7 2016-10-21

  • Updated data to IANA TZDB 2016h. #403

0.5.6 2016-10-08

  • Updated data to IANA TZDB 2016g. #394

0.5.5 2016-07-24

  • Updated data to IANA TZDB 2016f. #360

0.5.4 2016-05-03

  • Updated data to IANA TZDB 2016d. #336
  • Ignore the results from Intl.DateTimeFormat().resolvedOptions().timeZone if it is undefined. #322

0.5.3 2016-03-24

  • Updated data to IANA TZDB 2016c. #321

0.5.2 2016-03-15

  • Updated data to IANA TZDB 2016b. #315

0.5.1 2016-03-01

  • Updated data to IANA TZDB 2016a. #299
  • Fixed bug when Date#toTimeString did not return a known format. #302 #303
  • Added lookup on Intl.DateTimeFormat().resolvedOptions().timeZone to moment.tz.guess(). #304 #291

0.5.0 2015-12-28

  • Added support for guessing the user's timezone via moment.tz.guess(). #285
  • Fixed UMD export issue when there was an html element with id=exports. #275
  • Removed jspm specific dependencies from package.json. #284

0.4.1 2015-10-07

  • Updated data to IANA TZDB 2015e. #253
  • Updated data to IANA TZDB 2015f. #253
  • Updated data to IANA TZDB 2015g. #255
  • Added jspm dependencies for moment. #234
  • Included builds directory in npm. #237
  • Removed version field from bower.json. #230

0.4.0 2015-05-30

  • Updated data to IANA TZDB 2015b. #201
  • Updated data to IANA TZDB 2015c. #214
  • Updated data to IANA TZDB 2015d. #214
  • Updated zone getter to allow lazy unpacking to improve initial page load times. #216
  • Added a package.json jspm:main entry point. #194
  • Added composer.json. #222
  • Added an error message when trying to load moment-timezone twice. #212

0.3.1 2015-03-16

  • Updated data to IANA TZDB 2015a. #183

0.3.0 2015-01-13

  • Breaking: Added country data to the meta/*.json files. Restructured the data to support multiple countries per zone. #162
  • Added the ability to set a default timezone for all new moments. #152
  • Fixed a bug when passing a moment with an offset to moment.tz. #169
  • Fixed a deprecation in moment core, changing moment#zone to moment#utcOffset. #168

0.2.5 2014-11-12

  • Updated data to IANA TZDB 2014j. #151

0.2.4 2014-10-20

  • Updated data to IANA TZDB 2014i. #142

0.2.3 2014-10-20

  • Updated data to IANA TZDB 2014h. #141

0.2.2 2014-09-04

  • Updated data to IANA TZDB 2014g. #126
  • Added a warning when using moment-timezone with moment<2.6.0.

0.2.1 2014-08-02

0.2.0 2014-07-21

  • Added the ability to configure whether ambiguous or invalid input is rolled forward or backward. #101
  • Added moment>=2.6.0 as a dependency in bower.json. #107
  • Fixed getting the name of a zone that was added as a linked zone. #104
  • Added an error message when a zone was not loaded. #106

0.1.0 2014-06-23

  • Breaking: Changed data format from Zones+Rules to just Zones. #82
  • Breaking: Removed moment.tz.{addRule,addZone,zoneExists,zones} as they are no longer relevant with the new data format.
  • Made library 20x faster. JSPerf results
  • Completely rewrote internals to support new data format.
  • Updated the data collection process to get data directly from http://www.iana.org/time-zones.
  • Updated data to IANA TZDB 2014e.
  • Updated bower.json to use a browser specific main: entry point.
  • Added built files with included data.
  • Added support for accurately parsing input around DST changes. #93
  • Added comprehensive documentation at momentjs.com/timezone/docs/.
  • Added moment.tz.link for linking two identical zones.
  • Added moment.tz.zone for getting a loaded zone.
  • Added moment.tz.load for loading a bundled version of data from the IANA TZDB.
  • Added moment.tz.names for getting the names of all the loaded timezones.
  • Added moment.tz.unpack and moment.tz.unpackBase60 for unpacking data.
  • Added moment-timezone-utils.js for working with the packed and unpacked data.
  • Fixed major memory leak. #79
  • Fixed global export to allow use in web workers. #78
  • Fixed global export in browser environments that define window.module. #76

0.0.6 2014-04-20

  • Fixed issue with preventing loading moment-timezone more than once. #75

0.0.5 2014-04-17

  • Improved performance with memoization. #39
  • Published only necessary files to npm. #46
  • Added better handling of timezones around DST. #53 #61 #70
  • Added Browserify support. #41
  • Added moment.tz.zoneExists #73
  • Fixed cloning moments with a timezone. #71
  • Prevent loading moment-timezone more than once. #74

0.0.3 2013-10-10

  • Added Bower support.
  • Added support for newer versions of moment.
  • Added support for constructing a moment with a string and zone.
  • Added more links and timezone names in moment-timezone.json

0.0.1 2013-07-17

  • Initial version.