Huge News!Announcing our $40M Series B led by Abstract Ventures.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.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
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

FAQs

Package last updated on 02 Oct 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