Time transition may happen at the wrong moment.
I noticed the issue for the Asia/Novosibirsk timezone
on 20 Oct 2014. TimezoneJS shows transition
a bit later than 9:00 AM instead of precisely at 2:00 AM.
It does not matter if the script runs in Firefox
that respects time transitions history
or in Chromium that follows ECMAScript standard.
This time transition is not a regular DST transition.
Browsers were running in the same Asia/Novosibirsk timezone.
Firefox:
...
timestamp native Date timestampJS.Date
...
1414262700 01:45:00 GMT+0700 (NOVT) 1:45 AM
1414263600 01:00:00 GMT+0600 (NOVT) 2:00 AM <-
1414264500 01:15:00 GMT+0600 (NOVT) 2:15 AM
...
1414288800 08:00:00 GMT+0600 (NOVT) 9:00 AM
1414289700 08:15:00 GMT+0600 (NOVT) 8:15 AM <-
1414290600 08:30:00 GMT+0600 (NOVT) 8:30 AM
...
Chromium
...
1414262700 00:45:00 GMT+0600 (NOVT) 1:45 AM
1414263600 01:00:00 GMT+0600 (NOVT) 2:00 AM
1414264500 01:15:00 GMT+0600 (NOVT) 2:15 AM
...
1414288800 08:00:00 GMT+0600 (NOVT) 9:00 AM
1414289700 08:15:00 GMT+0600 (NOVT) 8:15 AM <-
1414290600 08:30:00 GMT+0600 (NOVT) 8:30 AM
...
<!DOCTYPE HTML>
<html>
<head>
<meta charset="UTF-8">
<title>Timezone-js time transition</title>
<script type="text/javascript"
src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script type="text/javascript" src="timezone-js/src/date.js"></script>
<script type="text/javascript">
//<!--
timezoneJS.timezone.zoneFileBasePath = 'tz';
//-->
</script>
</head>
<body>
<h1><a href="https://github.com/mde/timezone-js">Timezone-js</a> time transition</h1>
<pre id="result"></pre>
<script>//<!--
var testTz = "Asia/Novosibirsk";
var testTimestamp = 1414263600;
function getTimes(startTimestamp, duration, step) {
step = step || 15*60;
var result = "timestamp native Date timestampJS.Date";
var nativePrev = { hours: 0, minutes: 0 };
var tzjsPrev = { hours: 0, minutes: 0 };
for (var dt = 0; dt < duration; dt += step) {
var t = (startTimestamp + dt)*1000;
var nativeDate = new Date(t);
var tzjsDate = new timezoneJS.Date(t, testTz);
var nativeBack = nativeDate.getHours() < nativePrev.hours || (
nativeDate.getHours() === nativePrev.hours
&& nativeDate.getMinutes() < nativePrev.minutes
);
var tzjsBack = tzjsDate.getHours() < tzjsPrev.hours || (
tzjsDate.getHours() === tzjsPrev.hours
&& tzjsDate.getMinutes() < tzjsPrev.minutes
);
result += "\n" + [
(t/1000),
nativeDate.toTimeString(),
tzjsDate.toTimeString(),
nativeBack || tzjsBack ? "<-" : null
].join(" ");
nativePrev.hours = nativeDate.getHours();
nativePrev.minutes = nativeDate.getMinutes();
tzjsPrev.hours = tzjsDate.getHours();
tzjsPrev.minutes = tzjsDate.getMinutes();
}
return result;
}
document.getElementById("result").innerHTML =
getTimes(testTimestamp - 2*3600, 10*3600);
//--></script>
</body>
</html>
Time transition may happen at the wrong moment. I noticed the issue for the Asia/Novosibirsk timezone on 20 Oct 2014. TimezoneJS shows transition a bit later than 9:00 AM instead of precisely at 2:00 AM. It does not matter if the script runs in Firefox that respects time transitions history or in Chromium that follows ECMAScript standard. This time transition is not a regular DST transition. Browsers were running in the same Asia/Novosibirsk timezone.
Firefox:
Chromium