Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@types/moment-timezone

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/moment-timezone

Stub TypeScript definitions entry for moment-timezone, which provides its own types definitions

  • 0.5.30
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is @types/moment-timezone?

@types/moment-timezone provides TypeScript type definitions for the moment-timezone library, which is an extension of moment.js for handling time zones. It allows developers to work with dates and times in different time zones, convert between them, and perform various date-time manipulations with type safety.

What are @types/moment-timezone's main functionalities?

Time Zone Conversion

Convert a date-time from one time zone to another. In this example, a date-time in 'America/New_York' is converted to 'Europe/London'.

const moment = require('moment-timezone');
const date = moment.tz('2023-10-01 12:00', 'America/New_York');
const convertedDate = date.tz('Europe/London');
console.log(convertedDate.format());

Get Time Zone Names

Retrieve a list of all available time zone names. This can be useful for populating a dropdown menu or validating user input.

const moment = require('moment-timezone');
const timeZones = moment.tz.names();
console.log(timeZones);

Get Time Zone Offset

Get the UTC offset for a specific time zone. This can be useful for displaying the offset to users or performing calculations.

const moment = require('moment-timezone');
const offset = moment.tz('America/New_York').utcOffset();
console.log(offset);

Format Date-Time in Time Zone

Format a date-time string in a specific time zone. This example formats a date-time in 'America/New_York' with a specific format.

const moment = require('moment-timezone');
const date = moment.tz('2023-10-01 12:00', 'America/New_York');
console.log(date.format('YYYY-MM-DD HH:mm:ss Z'));

Other packages similar to @types/moment-timezone

FAQs

Package last updated on 12 Aug 2020

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc