Replies: 2 comments 6 replies
-
granted we convert from ICU skeleton to ECMA402 options which, under the hood does best match skeleton matching anw. If I'm understanding this correctly the only difference between |
Beta Was this translation helpful? Give feedback.
6 replies
-
I'm not able mark this discussion as answered :\ |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
TLDR: I'm trying to add support for time skeleton pattern "j" but the locale is required to parse it. Would passing down the locale as part of
ParserOptions
a feasible idea? If not, what would be a good way to pass the locale to@formatjs/icu-messageformat-parser/parser()
?Locale aware time skeleton patterns are very convenient and are encouraged to be used when formatting time. e.g. instead of trying to figure out if it's "h" or "H" you can simply pass in "j" and the formatter can figure out what the locale prefers. But as we know support for all date/time skeleton symbols are not complete.
I'm trying to figure out how to add support for "j". According to the spec "j", "J" and "C" are supposed to be converted to date/time patterns before processing (according to the spec).
I've a prototype method that pre-processes the skeleton pattern and returns the best matching date pattern when a locale is provided. It makes sense to keep this method in
@formatjs/icu-skeleton-parser
or@formatjs/icu-messageformat-parser
. But there isn't an easy way to pass thelocale
to these parsers.The current solution I've come up so far is to pass it down as part of the
options
prop — I don't like this approach myself that much:packages/intl-messageformat/src/core.ts
packages/icu-messageformat-parser/parser.ts
Beta Was this translation helpful? Give feedback.
All reactions