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

@js-joda/timezone

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@js-joda/timezone

iana tzdb timezone bindings for js-joda

  • 2.21.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
148K
increased by30.18%
Maintainers
2
Weekly downloads
 
Created

What is @js-joda/timezone?

@js-joda/timezone is an npm package that extends the js-joda library to handle time zones. It provides functionality for working with dates and times in different time zones, making it easier to perform operations like converting between time zones, getting the current time in a specific time zone, and more.

What are @js-joda/timezone's main functionalities?

Convert between time zones

This feature allows you to convert a date and time from one time zone to another. The code sample demonstrates converting the current time in 'America/New_York' to 'Europe/London'.

const { ZonedDateTime, ZoneId } = require('@js-joda/core');
const { ZoneRulesProvider } = require('@js-joda/timezone');

const zonedDateTime = ZonedDateTime.now(ZoneId.of('America/New_York'));
const convertedDateTime = zonedDateTime.withZoneSameInstant(ZoneId.of('Europe/London'));
console.log(convertedDateTime.toString());

Get current time in a specific time zone

This feature allows you to get the current time in a specific time zone. The code sample demonstrates getting the current time in 'Asia/Tokyo'.

const { ZonedDateTime, ZoneId } = require('@js-joda/core');
const { ZoneRulesProvider } = require('@js-joda/timezone');

const currentTimeInTokyo = ZonedDateTime.now(ZoneId.of('Asia/Tokyo'));
console.log(currentTimeInTokyo.toString());

List available time zones

This feature allows you to list all available time zones. The code sample demonstrates how to retrieve and print all available time zone IDs.

const { ZoneId } = require('@js-joda/core');
const { ZoneRulesProvider } = require('@js-joda/timezone');

const availableZoneIds = ZoneRulesProvider.getAvailableZoneIds();
console.log(availableZoneIds);

Other packages similar to @js-joda/timezone

Keywords

FAQs

Package last updated on 18 Jun 2024

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