// This tests JScript clock change dates; errors in Win 7 & 10
// Run in WSH at command line with Prompt>cscript //nologo jscptbug.js
// For a browser, remove use of WScript object and use alert(Out)
var IzzDat, IzzOff, WozDat, WozOff = NaN, J, Out = []
Out.push(" JSCPTBUG.JS\t(c) J R Stockton\t2018-01-29+")
Out.push(
"\n Your " + WScript.Name + " is version " + WScript.version +
"\n Your Script Engine is " + ScriptEngine() + " " +
ScriptEngineMajorVersion() + "." +
ScriptEngineMinorVersion() + "." + ScriptEngineBuildVersion() )
IzzDat = new Date()
Out.push(" They say :\n LCT = " + IzzDat.toString() +
"\n GMT = " + IzzDat.toUTCString())
Out.push(
" The following shows roughly when your civil clock offset\n" +
" changes over four years, according to your Script Engine.")
function Pad5(N) { var S = String(N)
while (S.length < 5) S = " " + S ; return S }
for (J = 0 ; J < 1475 ; J++) {
IzzDat = new Date(2017, 0, J) ; IzzOff = IzzDat.getTimezoneOffset()
if (J > 0 && IzzOff != WozOff) {
Out.push("")
Out.push(Pad5(WozOff) + " " + WozDat)
Out.push(Pad5(IzzOff) + " " + IzzDat)
}
WozOff = IzzOff ; WozDat = IzzDat
}
Out = Out.join("\n") + "\n -----"
// alert(Out)
WScript.StdOut.WriteLine(Out)
// End
Running in current Chrome, as indicated at the top, for 2018 I get
0 Sun Mar 25 2018 00:00:00 GMT+0000 (GMT Standard Time)
-60 Mon Mar 26 2018 00:00:00 GMT+0100 (GMT Daylight Time)
-60 Sun Oct 28 2018 00:00:00 GMT+0100 (GMT Daylight Time)
0 Mon Oct 29 2018 00:00:00 GMT+0000 (GMT Standard Time)
which are the correct dates for the EU.
Running in WSH in the UK, for 2018 I get
0 Sun Mar 11 00:00:00 UTC 2018
-60 Mon Mar 12 00:00:00 UTC+0100 2018
-60 Sun Nov 4 00:00:00 UTC+0100 2018
0 Mon Nov 5 00:00:00 UTC 2018
showing the US time change dates.
--
(c) John Stockton, near London, UK. Using Google Groups. |
Mail: J.R.""""""""@
physics.org - or as Reply-To, if any. |