You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EDIT: I spent some time reading the datetime options length source code, and unless I'm missing something, this isn't possible?
I can do this, but can't independently adjust or turn off years, or days, for a date?
I'm working on a project where I need localization, and this seems perfect. But I'm confused on how to implement it.
My prototype was in typescript, where I have this function:
formatDate(date: string,options: Intl.DateTimeFormatOptions): string {constparsedDate=edtf.default(date);constoptKeys=Object.keys(options);// read the options from the input styleconstformattedDate=edtf.format(parsedDate,"en-US",options);returnformattedDate;}
The input JSON for the two projects will actually be the same, and has two pieces.
First, there's an options section, which in YAML looks like this:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
EDIT: I spent some time reading the datetime options length source code, and unless I'm missing something, this isn't possible?
I can do this, but can't independently adjust or turn off years, or days, for a date?
I'm working on a project where I need localization, and this seems perfect. But I'm confused on how to implement it.
My prototype was in typescript, where I have this function:
The input JSON for the two projects will actually be the same, and has two pieces.
First, there's an options section, which in YAML looks like this:
... and then there are templates, which look like this:
So I need to be able to map those "format" strings, whose values are "year", "month_day" and such, to the icu datetime config.
To bottom line it, then, how do I configure, say, only month formatting for a date, or only year?
PS - in the typescript, I have this function to configure it; I'm looking for something equivalent.
Beta Was this translation helpful? Give feedback.
All reactions