JavascriptNet / Javascript.Net

.Net bindings to the V8 JavaScript engine
BSD 2-Clause "Simplified" License
829 stars 150 forks source link

Removed manual conversion to local time in date conversions #55

Closed Ablu closed 5 years ago

Ablu commented 6 years ago

Calling ToLocalTime() leads to changes of the hour component. Since in JavaScript Date is basically simply a number starting from 1970-01-01 UTC we should not do any conversions here. This also means that the test which simply checked that new Date(2010, 9, 10) equals new DateTime(2010, 10, 10) was wrong. C# does not do any conversions by default, so new DateTime(2010, 10, 10) does not specificy any timezone. The JavaScript code should match the UTC Date of 2010-10-10 (00:00:00) converted to the local timezone, for example, 2010-10-09 (22:00:00) for MESZ (GMT+2).

Ablu commented 6 years ago

Interesting... The Appveyor build fails when comparing new Date() with the current DateTime from C#... Locally it works. I will try to see what goes wrong there...

Ablu commented 5 years ago

@spahnke would be cool if you could check whether the tests make sense. Date stuff is always ugly... :/.

@oliverbock should work now :)

Ablu commented 5 years ago

somehow github did not handle my forced push to my branch...

Ablu commented 5 years ago

Ok. A second forced push fixed it

spahnke commented 5 years ago

I will review this on Monday.

Ablu commented 5 years ago

CI failure is an unrelated test