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

timezone-support

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone-support

Lightweight time zone support for your applications or other date libraries.

  • 3.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
143K
increased by16.53%
Maintainers
1
Weekly downloads
 
Created

What is timezone-support?

The timezone-support npm package provides utilities for working with time zones, including converting dates between time zones, parsing and formatting dates, and handling daylight saving time transitions.

What are timezone-support's main functionalities?

Convert Date Between Time Zones

This feature allows you to convert a date from one time zone to another. The code sample demonstrates converting a UTC date to 'America/New_York' time zone.

const { convertTimeToTimeZone } = require('timezone-support');
const { parseFromTimeZone, formatToTimeZone } = require('date-fns-timezone');

const date = new Date('2023-10-01T12:00:00Z');
const timeZone = 'America/New_York';
const convertedDate = convertTimeToTimeZone(date, { timeZone });
console.log(convertedDate);

Parse Date from Time Zone

This feature allows you to parse a date string in a specific time zone. The code sample demonstrates parsing a date string in the 'America/New_York' time zone.

const { parseFromTimeZone } = require('timezone-support');

const dateStr = '2023-10-01 12:00:00';
const timeZone = 'America/New_York';
const parsedDate = parseFromTimeZone(dateStr, { timeZone });
console.log(parsedDate);

Format Date to Time Zone

This feature allows you to format a date to a specific time zone. The code sample demonstrates formatting a UTC date to 'America/New_York' time zone with a specific format.

const { formatToTimeZone } = require('timezone-support');

const date = new Date('2023-10-01T12:00:00Z');
const timeZone = 'America/New_York';
const format = 'YYYY-MM-DD HH:mm:ss [GMT]Z (z)';
const formattedDate = formatToTimeZone(date, { timeZone, format });
console.log(formattedDate);

Other packages similar to timezone-support

Keywords

FAQs

Package last updated on 04 Dec 2022

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