Open vvavepacket opened 3 months ago
DateTime#toLocaleString
pretty much just calls Intl.DateTimeFormat#format
. The actual format is implementation defined and may change between runtimes (different browsers) or even different versions.
Check the underlying platform by using Intl.DateTimeFormat#format
directly and possibly file an issue at the corresponding platform if you feel like it is not behaving according to spec.
Moreover I want to understand what the language-Country combination plays in luxon when interpreting timestamps?
When formatting, it is as described above.
When parsing, macro tokens (for example DDDD
) are expanded using Intl.DateTimeFormat#formatToParts
and a dummy date time. The resulting output is then back-matched to single tokens, for example { type: "weekday", value: "Monday" }
will be matched to EEE
or EEEE
. Those non-macro tokens are then used for parsing normally.
Hope this helps!
Describe the bug In Luxon timestamp formatting, we have the ability to provide the locale like the following:
en-US
will be English language and US as the countryes-ES
will be Spanish language and Spain as the countryes-US
will be Spanish language and US as the countryNow, given we have the timestamp
2024-03-05T14:09:47Z
, and when we applied the respective locales, below is the current outputen-US
will be3/5/2024, 2:09:42 PM UTC
es-ES
will be5/3/2024, 14:06:32 UTC
es-US
will be5/3/2024, 2:09:47 p. m. UTC
The issue lies with
es-US
. We know the language should beSpanish, so all language should be translated in Spanish format.. But the country is set to
US. This means it should follow the
mm/dd/yyyy` format right?I'm expecting
es-US
will be the following output:`3/5/2024 .......
To Reproduce Please share a minimal code example that triggers the problem:
Actual vs Expected behavior A clear and concise description of what you expected to happen.
Given in the locale, the country is set to US i.e.
en-US
,es-US
, then the date time format should bemm/dd/yyyy
instead of using the language set in the locale.Moreover I want to understand what the
language-Country
combination plays in luxon when interpreting timestamps?Desktop (please complete the following information):