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

@internationalized/date

Package Overview
Dependencies
Maintainers
0
Versions
625
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@internationalized/date

Internationalized calendar, date, and time manipulation utilities

  • 3.0.0-nightly-9421c1409-240921
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
660K
decreased by-63.12%
Maintainers
0
Weekly downloads
 
Created

What is @internationalized/date?

@internationalized/date is a JavaScript library that provides utilities for handling dates and times in an internationalized manner. It offers a range of functionalities including date manipulation, formatting, and parsing, all with support for various locales and calendars.

What are @internationalized/date's main functionalities?

Date Manipulation

This feature allows you to manipulate dates by adding or subtracting days, months, or years. The code sample demonstrates how to add 5 days to a given date.

const { CalendarDate, addDays } = require('@internationalized/date');
const date = new CalendarDate(2023, 10, 5);
const newDate = addDays(date, 5);
console.log(newDate); // Outputs: CalendarDate { year: 2023, month: 10, day: 10 }

Date Formatting

This feature provides utilities to format dates according to different locales. The code sample shows how to format a date in the 'en-US' locale.

const { CalendarDate, DateFormatter } = require('@internationalized/date');
const date = new CalendarDate(2023, 10, 5);
const formatter = new DateFormatter('en-US');
console.log(formatter.format(date)); // Outputs: 10/5/2023

Date Parsing

This feature allows you to parse date strings into date objects according to different locales. The code sample demonstrates parsing a date string in the 'en-US' locale.

const { DateFormatter } = require('@internationalized/date');
const formatter = new DateFormatter('en-US');
const date = formatter.parse('10/5/2023');
console.log(date); // Outputs: CalendarDate { year: 2023, month: 10, day: 5 }

Support for Multiple Calendars

This feature provides support for multiple calendar systems. The code sample shows how to create a date object using the Japanese calendar.

const { CalendarDate, JapaneseCalendar } = require('@internationalized/date');
const date = new CalendarDate(2023, 10, 5, new JapaneseCalendar());
console.log(date); // Outputs: CalendarDate { year: 2023, month: 10, day: 5, calendar: JapaneseCalendar }

Other packages similar to @internationalized/date

FAQs

Package last updated on 21 Sep 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