In JavaScript, what is the maximum value for the year in a Date?
How can I find this out in code?
I have tried the following:
new Date().getFullYear().MAX_VALUE;
Thanks in advance.
JavaScript does not have a date data type. However, you can use the Date object and its methods to work with dates and times in your applications. The Date object has a large number of methods for setting, getting, and manipulating dates. It does not have any properties.
$ and $$ are valid variable names in JavaScript, they have no special meaning. Usually they set their value to library instances, in your example if you check the closure call, at the end of the file you'll see that $ is jQuery in this case if it is defined and $$ is cytoscape.
Remarks. The value of this constant is equivalent to 00:00:00.0000000 UTC, January 1, 0001, in the Gregorian calendar. MinValue defines the date and time that is assigned to an uninitialized DateTime variable.
As per specs here: https://262.ecma-international.org/11.0/#sec-time-values-and-time-range : The actual range of times is 8,640,000,000,000,000 milliseconds to either side of 01 January, 1970 UTC. So, the maximum valid year you will get is 275760 (new Date(8640000000000000).getFullYear()
). And to get the minimum valid year, new Date(-8640000000000000).getFullYear()
or 271821 B.C.E.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With