While the timestamp has recently exceeded 1.5 billion, a strange (and apparently random) error occurs in one of my scripts.
I need to initialize dateTimePicker, I did this:
$('#datepickerfield').data('DateTimePicker').date(new Date(1502173800000));
1502173800000 is, of course, a millisecond timestamp. In most cases, it just works .
But, as you can see, somehow 15021738 ... maybe (and actually, once, IS) is mistakenly interpreted as 15/02/1738 (French format dd / mm / yyyy) ... It was not so with timestamps starting at 1499 or even 1500, and the error only appears when the timestamps start at 1501 (leading to January 15), etc.
It appears RANDOMLY, which is very unpleasant and almost impossible to fix on the server side (too many cases to consider, even a date such as 15/02/1738 may be legal in some contexts)
I had two questions:
- Has anyone ever experienced this? Is this a javascript javascript error (I searched but did not find a complaint about this.)
- How can I replace this challenge with a better one? I am using Angular v1.5, Moment.js, JQuery 2.x - this exact call is in the Angular controller.
Thank you for the attention
Denis
source
share