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
Follow-up to #3375 in a new issue, with a summary of current proposition.
The tokens used to format a moment based on its locale LT LTS L l LL lll LLL lll LLLL llll are configured in the source code with a fixed string of sub-tokens, independently of the actual moment being formatted.
This is unfortunately insufficient to express how dates and times should be formatted in some locales. The sub-tokens to use can vary with the actual date or time being formatted.
Example is French, where the way to pronounce and write day of month depends on the actual day of month. It is an ordinal for 1 and a cardinal for 2+. E.g. correct sub-tokens for LLL are:
When day of month = 1: Do MMMM YYYY HH:mm
Otherwise: D MMMM YYYY HH:mm
Current code has to choose one of the two (for instance second one), and gets the date improperly formatted in about 1/30 cases.
I suggest to introduce new token LD.
By default, it has the same value as Do.
Locales can then refine. French locale would for example define: LD: value of Do when day of month being formatted = 1, value of D otherwise LLL: LD MMMM YYYY HH:mm
Other ideas to implement this problem ?
The text was updated successfully, but these errors were encountered:
@fbonzon I skimmed over #3375, but I'm afraid we do not want to add yet another token to all locales to fix a particular locale weirdness.
What I am more open to is provide more "hook/plugin" points for locales that do want to do something crazy to be able to (like preparse and postformat). Actually this particular issue might be solved with postformat (although ugly).
Option 1 from #3375 is more in-line with what I'm talking about. Sadly option 2 is easier, but the locale-related code-creep in moment is just unmanageable any more.
Follow-up to #3375 in a new issue, with a summary of current proposition.
The tokens used to format a moment based on its locale
LT LTS L l LL lll LLL lll LLLL llll
are configured in the source code with a fixed string of sub-tokens, independently of the actual moment being formatted.This is unfortunately insufficient to express how dates and times should be formatted in some locales. The sub-tokens to use can vary with the actual date or time being formatted.
Example is French, where the way to pronounce and write day of month depends on the actual day of month. It is an ordinal for 1 and a cardinal for 2+. E.g. correct sub-tokens for
LLL
are:Do MMMM YYYY HH:mm
D MMMM YYYY HH:mm
Current code has to choose one of the two (for instance second one), and gets the date improperly formatted in about 1/30 cases.
I suggest to introduce new token
LD
.By default, it has the same value as
Do
.Locales can then refine. French locale would for example define:
LD
: value ofDo
when day of month being formatted = 1, value ofD
otherwiseLLL
:LD MMMM YYYY HH:mm
Other ideas to implement this problem ?
The text was updated successfully, but these errors were encountered: