Socket
Socket
Sign inDemoInstall

moment-timezone

Package Overview
Dependencies
1
Maintainers
2
Versions
62
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    moment-timezone

Parse and display moments in any timezone.


Version published
Maintainers
2
Install size
6.10 MB
Created

Package description

What is moment-timezone?

The moment-timezone package is an extension for the moment.js library that allows users to parse and display dates in any timezone. It provides timezone data and functions to work with dates in different time zones.

What are moment-timezone's main functionalities?

Parsing Dates in Timezones

This feature allows you to create a moment object with a specified timezone. The code sample creates a moment object for the time and date '2013-11-18 11:55' in the 'America/Toronto' timezone.

moment.tz('2013-11-18 11:55', 'America/Toronto')

Converting Dates to Different Timezones

This feature enables you to convert the current time to a different timezone. The code sample converts the current time to the 'America/New_York' timezone and formats it as a string.

moment().tz('America/New_York').format()

Retrieving Timezone Names

This feature provides a list of all the timezone names available in the moment-timezone library. The code sample retrieves an array of timezone names.

moment.tz.names()

Working with UTC Offsets

This feature allows you to work with UTC offsets directly. The code sample parses a date with a specific UTC offset and retrieves that offset in minutes.

moment.parseZone('2013-01-01T00:00:00-13:00').utcOffset()

Other packages similar to moment-timezone

Changelog

Source

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

Readme

Source

Moment Timezone

NPM version NPM downloads MIT License Build Status

IANA Time Zone Database + Moment.js.

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
Contribute code or compile time zone data
Read the changelog

Keywords

FAQs

Last updated on 23 Jun 2014

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc