Closed vvavepacket closed 3 months ago
Luxon uses Intl.DateTimeFormat
for formatting. You can observe the same behavior when using that API directly:
const dtf = new Intl.DateTimeFormat(
'es-ES',
{
year: "numeric",
month: "numeric",
day: "numeric",
hour: "numeric",
minute: "numeric",
second: "numeric",
timeZoneName: "short",
timeZone: "America/New_York"
}
);
const date = new Date(Date.parse("2024-02-26T18:35:12Z"));
console.log(dtf.format(date));
This is completely within the spec as far as I know, it is not specified how time zones must be formatted.
Describe the bug Lets say I set the locale to
es-ES
(spanish, Spain). Now given some timestamp and I want to convert it toAmerica/New_York
, why is that the short code is being displayed inGMT-5
rather than using the native timezone assigned to New Yorkers likeEST
?Who dictates this logic? Is it in somewhere in library, or in the Javascript API itself?
To Reproduce Please share a minimal code example that triggers the problem:
Try the below code
the output of
convertedTimestamp
will be26/2/2024, 13:35:12 GMT-5
Actual vs Expected behavior I'm expecting the output to display
26/2/2024, 13:35:12 EST
since the timezone I specified isAmerica/New_York
, then it should use the native timezone short code for that region which isEST
. Isn't that the case? Whats the explanation for this behavior?Desktop (please complete the following information):