Closed Bug 1568737 Opened 5 years ago Closed 5 years ago

Wrong time output using Intl.DateTimeFormat with zone info

Categories

(Core :: JavaScript: Internationalization API, defect)

70 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: hakandev123, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.100 Safari/537.36

Steps to reproduce:

var date = new Date(Date.UTC(2012, 11, 20, 0, 0, 0));

var options = {
year: 'numeric', month: 'short', day: 'numeric',
hour: 'numeric', minute: 'numeric', second: 'numeric',
hour12: false, timeZone: 'Europe/Istanbul'
};

console.log(new Intl.DateTimeFormat('tr-Tr', options).format(date));

Actual results:

The code above produces "02:00:00".

Expected results:

Time zone for 'Europe/Istanbul' is +03.00. So it should have produced "03:00:00".

Component: Untriaged → JavaScript: Internationalization API
Product: Firefox → Core

Turkey switched to +03 all year round in 2016, but the input date from comment #0 is in 2012, where Turkey was still using +02 with daylight savings. So it seems to me that the result "02:00:00" is correct. Also compare:

js> console.log(new Intl.DateTimeFormat('tr-TR', options).format(new Date(Date.UTC(2012, 11, 20, 0, 0, 0))));
20 Ara 2012 02:00:00
js> console.log(new Intl.DateTimeFormat('tr-TR', options).format(new Date(Date.UTC(2016, 11, 20, 0, 0, 0)))); 
20 Ara 2016 03:00:00

@hakandev123
Can you clarify why "03:00:00" should be returned? Is there a different browser which returns that result?


For reference from the IANA time zone database:

# Zone	NAME		STDOFF	RULES	FORMAT	[UNTIL]
Zone	Europe/Istanbul	1:55:52 -	LMT	1880
			1:56:56	-	IMT	1910 Oct # Istanbul Mean Time?
			2:00	Turkey	EE%sT	1978 Oct 15
			3:00	Turkey	+03/+04	1985 Apr 20
			2:00	Turkey	EE%sT	2007
			2:00	EU	EE%sT	2011 Mar 27  1:00u
			2:00	-	EET	2011 Mar 28  1:00u
			2:00	EU	EE%sT	2014 Mar 30  1:00u
			2:00	-	EET	2014 Mar 31  1:00u
			2:00	EU	EE%sT	2015 Oct 25  1:00u
			2:00	1:00	EEST	2015 Nov  8  1:00u
			2:00	EU	EE%sT	2016 Sep  7
			3:00	-	+03
Flags: needinfo?(hakandev123)

You are right, I overlooked that. Issue can be closed. Thanks.

Flags: needinfo?(hakandev123)
Status: UNCONFIRMED → RESOLVED
Closed: 5 years ago
Resolution: --- → INVALID

Thanks for confirming it!

You need to log in before you can comment on or make changes to this bug.