0 votes Vote

Error in defining the year in Date()

Hello Vladimir,

First of all thank you for this really nice calculator and the js library of it you provide us.

I noticed that you probably calculate with the wrong year; let me explain what I mean:
The js Date() constructor uses as first parameter the year as you know. There are a couple of ways how to enter the year. I guess you are using only the last two digits of the year, so for 2014 you are using 14. This results however in a calculation based on the year 1914 which causes a difference of (just) 1 to 2 minutes. Following the manual of Mozilla it should be also possible to enter 114 (means 1900+114=2014) but when I tested this it resulted in a calculating based on the year 114 so ignore that option.

So my suggestion is to check if your script indeed calculates with the last two digits (14) in stead of the full year (2014) which gives a 100 year difference and a slightly difference in the result of the calculation of the times. If in doubt you can also use the function .setFullYear() ofcourse but note that this results in a timestamp (I also got a difference of 1 minute while using this function for some reason I don't know..).

Regards,
Stefan van Mierlo

Stefan , 25.08.2014, 10:09
Idea status: under consideration

Comments

Leave a comment