New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@messageformat/date-skeleton

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@messageformat/date-skeleton

A parser & formatter for ICU DateFormat skeleton strings

1.0.0
Source
npm
Version published
Weekly downloads
412K
2.35%
Maintainers
1
Weekly downloads
 
Created

What is @messageformat/date-skeleton?

@messageformat/date-skeleton is an npm package that provides utilities for formatting dates using skeletons, which are patterns that describe the desired components and their order in a date format. This package is useful for internationalization (i18n) and localization (l10n) of date formats.

What are @messageformat/date-skeleton's main functionalities?

Basic Date Formatting

This feature allows you to format a date using a skeleton pattern. In this example, the skeleton 'yMMMd' formats the date to 'Oct 1, 2023'.

const { DateSkeleton } = require('@messageformat/date-skeleton');
const date = new Date('2023-10-01T12:00:00Z');
const skeleton = new DateSkeleton('yMMMd');
console.log(skeleton.format(date)); // Output: Oct 1, 2023

Custom Time Formatting

This feature allows you to format the time part of a date using a skeleton pattern. In this example, the skeleton 'Hm' formats the time to '12:00'.

const { DateSkeleton } = require('@messageformat/date-skeleton');
const date = new Date('2023-10-01T12:00:00Z');
const skeleton = new DateSkeleton('Hm');
console.log(skeleton.format(date)); // Output: 12:00

Localized Date Formatting

This feature allows you to format a date using a skeleton pattern with localization. In this example, the skeleton 'yMMMd' with the locale set to 'fr' (French) formats the date to '1 oct. 2023'.

const { DateSkeleton } = require('@messageformat/date-skeleton');
const date = new Date('2023-10-01T12:00:00Z');
const skeleton = new DateSkeleton('yMMMd', { locale: 'fr' });
console.log(skeleton.format(date)); // Output: 1 oct. 2023

Other packages similar to @messageformat/date-skeleton

Keywords

icu

FAQs

Package last updated on 13 May 2021

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