Closed shinnqy closed 1 year ago
Luxon's localization abilities depend on the underlying browser and toLocaleString
is specified to be system dependent. Most systems use Unicode ICU, but this is neither required nor specified. The output is consistent most of the time, but this can change as underlying systems update. What you are observing here is that your version of Chrome has an updated ICU and Edge does not (yet).
If you need a date / time format which must never change then toLocaleString
is not the correct tool. Use toFormat
for that circumstance.
You may also find the note on the return value of toLocaleString interesting:
output variations are by design and allowed by the specification. You should not compare the results of toLocaleString() to static values.
Using toFormat
also generates different outputs:
revisionCreateDate.toFormat("fff", { locale: "en-US" })
From Node 16 (on Debian):
encodeURIComponent("August 4, 2010 at 2:51 PM UTC");
'August%204%2C%202010%20at%202%3A51%20PM%20UTC'
From Chrome 113 on Windows 10:
encodeURIComponent("August 4, 2010 at 2:51 PM UTC");
'August%204%2C%202010%20at%202%3A51%E2%80%AFPM%20UTC'
Describe the bug DateTime.toLocaleString has different behaviour in different browser.
Edge: Version 110.0.1587.50 (Official build) (64-bit)
Chrome: Version 110.0.5481.78 (Official Build) (64-bit)
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.
Expect: the output should be same in Edge and Chrome Acutal: Edge is unicode 32, while Chrome is unicode 8239
Desktop (please complete the following information):
Additional context Add any other context about the problem here.