- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
if ((new Date(2014, 0, 1)).getHours() != 0 || new Date(2015, 0, 7).getHours() != 0) {
// Переопределяем конструктор
Date = (function (NativeDate) {
var NewDate = function (Y, M, D, h, m, s, ms) {
var length = arguments.length;
var date = length === 1 && String(Y) === Y ? // isString(Y)
new NativeDate(NewDate.parse(Y)) :
length >= 7 ? new NativeDate(NativeDate.UTC(Y, M, D, h, m, s, ms)) :
length >= 6 ? new NativeDate(NativeDate.UTC(Y, M, D, h, m, s)) :
length >= 5 ? new NativeDate(NativeDate.UTC(Y, M, D, h, m)) :
length >= 4 ? new NativeDate(NativeDate.UTC(Y, M, D, h)) :
length >= 3 ? new NativeDate(NativeDate.UTC(Y, M, D)) :
length >= 2 ? new NativeDate(NativeDate.UTC(Y, M)) :
length >= 1 ? new NativeDate(Y) :
new NativeDate();
if (length == 0) {
date = new NativeDate(+date - date.getTimezoneOffset() * 60000);
}
date.constructor = NewDate;
return this instanceof NativeDate ? date : date.toString();
};
if (NativeDate.now) {
NewDate.now = function () {
return new NewDate().getTime();
};
}
if (NativeDate.UTC) {
NewDate._UTC = NativeDate.UTC;
NewDate.UTC = function (Y, M, D, h, m, s, ms) {
var _date = new NewDate(NewDate._UTC.apply(this, arguments));
return +_date - _date.getTimezoneOffset() * 60000;
};
}
NewDate.prototype = NativeDate.prototype;
NewDate.prototype.constructor = NewDate;
И так далее, "фикс" для кривых таймзон в JS на винде http://habrahabr.ru/post/243685/