//http://stackoverflow.com/questions/181348/instantiating-a-javascript-object-by-calling-prototype-constructor-apply
var date = new Date(y, m, d, h, M, s, ms);
- //the date constructor doesn't accept years < 1970
- if (y < 1970 && isFinite(date.getYear())) {
+ //the date constructor remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getYear())) {
date.setFullYear(y);
}
return date;
export function createUTCDate (y) {
var date = new Date(Date.UTC.apply(null, arguments));
- if (y < 1970 && isFinite(date.getUTCFullYear())) {
+
+ //the Date.UTC function remaps years 0-99 to 1900-1999
+ if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) {
date.setUTCFullYear(y);
}
return date;