Date does not have this
Actually, this happens, but only indirectly. According to the specification, the value of <milliseconds Date a milliseconds-after-the-Epoch object can only be in the range of -8640000000000000 to 8640000000000000.
So, the minimum date is new Date(-8640000000000000) (Tue, April 20 -271821 00:00:00 GMT), and the maximum date is new Date(8640000000000000) (Sat, Sep 13, 275760 00:00:00 GMT).
If you want, you can put them in the Date function as properties:
Date.MIN_VALUE = new Date(-8640000000000000); Date.MAX_VALUE = new Date(8640000000000000);
... but since Date instances are changing, I probably won't, because it is too easy to accidentally change one of them. An alternative would be to do this:
Object.defineProperties(Date, { MIN_VALUE: { value: -8640000000000000 // A number, not a date }, MAX_VALUE: { value: 8640000000000000 } });
Defines properties on Date that cannot be changed, which have a minimum / maximum numeric value for dates. (On a JavaScript engine that supports ES5.)
TJ Crowder Nov 23 '14 at 19:17 2014-11-23 19:17
source share