@messageformat/date-skeleton
A parser & formatter for ICU DateFormat skeleton strings
Last updated 4 years ago by eemeli .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @messageformat/date-skeleton 
SYNC missed versions from official npm registry.

@messageformat/date-skeleton

Tools for working with ICU DateFormat skeletons.

import {
  DateFormatError,
  DateToken, // TS only
  getDateFormatter,
  getDateFormatterSource,
  parseDateTokens
} from '@messageformat/date-skeleton';

The package is released as an ES module only. If using from a CommonJS context, you may need to import() it, or use a module loader like esm.

Uses Intl.DateTimeFormat internally. Position-dependent ICU DateFormat patterns are not supported, as they cannot be represented with Intl.DateTimeFormat options.

Classes

Class Description
DateFormatError Parent class for errors.

Functions

Function Description
getDateFormatter(locales, tokens, onError) Returns a date formatter function for the given locales and date skeleton
getDateFormatter(locales, tokens, timeZone, onError) Returns a date formatter function for the given locales and date skeleton with time zone overrride.
getDateFormatterSource(locales, tokens, onError) Returns a string of JavaScript source that evaluates to a date formatter function with the same (date: Date | number) => string signature as the function returned by getDateFormatter().
getDateFormatterSource(locales, tokens, timeZone, onError) Returns a string of JavaScript source that evaluates to a date formatter function with the same (date: Date | number) => string signature as the function returned by getDateFormatter() with time zone override .
parseDateTokens(src) Parse an ICU DateFormat skeleton string into a DateToken array.

Type Aliases

Type Alias Description
DateToken An object representation of a parsed date skeleton token

Messageformat is an OpenJS Foundation project, and we follow its Code of Conduct.

OpenJS Foundation

Current Tags

  • 1.1.0                                ...           latest (2 years ago)

4 Versions

  • 1.1.0                                ...           2 years ago
  • 1.0.1                                ...           4 years ago
  • 1.0.0                                ...           5 years ago
  • 1.0.0-beta.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 2
This Month 4
Last Day 2
Last Week 2
Last Month 0
Dependencies (0)
None
Dev Dependencies (0)
None
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |