What is @formatjs/icu-skeleton-parser?
The @formatjs/icu-skeleton-parser package is a utility for parsing ICU MessageFormat patterns into an abstract syntax tree (AST). It is part of the FormatJS suite of libraries, which are designed to help with internationalization of applications. This package specifically deals with the parsing of ICU MessageFormat skeletons, which are shorthand for specifying date and time formats.
What are @formatjs/icu-skeleton-parser's main functionalities?
Parsing ICU MessageFormat skeletons
This feature allows you to parse ICU MessageFormat skeletons into an AST. The code sample demonstrates how to parse a simple date skeleton ('MMMd') which represents a format like 'Jul 20'.
const { parse } = require('@formatjs/icu-skeleton-parser');
const ast = parse('MMMd');
console.log(ast);
Other packages similar to @formatjs/icu-skeleton-parser
intl-messageformat-parser
This package is also part of the FormatJS suite and provides functionality to parse ICU MessageFormat strings into an AST. It is similar to @formatjs/icu-skeleton-parser but focuses on the full MessageFormat pattern rather than just the skeleton.
messageformat
Messageformat is a library that provides ICU MessageFormat support, including parsing and formatting for different locales. It is a more comprehensive solution compared to @formatjs/icu-skeleton-parser, which focuses solely on parsing skeletons.
globalize
Globalize is a library for i18n and l10n that provides number formatting, date and time formatting, and message formatting. It uses the ICU MessageFormat patterns but does not expose a dedicated parsing API like @formatjs/icu-skeleton-parser.