thuri · GitHub

In browsers new Date("2021-12-18T22:23") seem to produce a local date time.
So when calling new Date("2021-12-18T22:23").toISOString() on my local machine (situated in Timezone Europe/Berlin) the resulting string will be 2021-12-18T21:23:00.000Z
The browser implementation seems to calculate the UTC time from the Date instance.

grafik

But when running this in HTMLUnit I wasn't able to get the correct UTC string. Even when setting the Timezone on the browser version.

I changed my example project https://github.com/thuri/htmlunit-jquery-selector-init that was created for #422 and added a new Test DateStringConversionTest.java and an new example html dateStringConversionTest.html where this behavior can be reproduced.

Probably i'm just missing some configuration here but I couldn't find something on the web

Read the original on github.com ↗