On Wednesday, March 14, 2018 at 9:18:19 PM UTC, Julio Di Egidio wrote:
> On Monday, 12 March 2018 19:26:33 UTC+1, Dr J R Stockton wrote:
>
> > At present, the second Sunday of March having started, when running
> > JScript in Windows (7 & 10) Script Host in the UK after 23:00 LCT,
> > D = new Date() thinks that it is tomorrow already, which upsets my
> > "show today's files" logic.
>
> Can you show code that reproduces the problem?
Yes.
> > The reason is that WSH believes that the
> > UK uses the US DST clock rules. I expect the fault to go away on
> > the last Sunday of March, and to reappear for a week from the last
> > Sunday of October, etc.
>
> It's hardly possible that such a "feature" would have gone unnoticed.
Never underestimate the chronological ineptitude of programmers on the wrong side of the Pacific Ocean.
Prompt>type jscptbug.js
// 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
Prompt>