Instead of new Date(string) we do new Date(year, month, day), which will give a local value for the ymd. This matters if you're west of GMT, where local midnight is not the same date as GMT midnight.
I also changed the test script so that it runs for two different timezones on either side of GMT, to make sure it works in all cases.
Instead of
new Date(string)
we donew Date(year, month, day)
, which will give a local value for the ymd. This matters if you're west of GMT, where local midnight is not the same date as GMT midnight.I also changed the test script so that it runs for two different timezones on either side of GMT, to make sure it works in all cases.