Browse Source

替换new Date为 Date.getDate

master
windy 7 years ago
parent
commit
5d0178e5a2
  1. 20
      bi/case.js
  2. 77
      bi/core.js
  3. 92
      bi/widget.js
  4. 189
      dist/bundle.js
  5. 82
      dist/bundle.min.js
  6. 20
      dist/case.js
  7. 77
      dist/core.js
  8. 92
      dist/widget.js
  9. 14
      src/case/calendar/calendar.js
  10. 6
      src/case/calendar/calendar.year.js
  11. 4
      src/core/base.js
  12. 73
      src/core/proto/date.js
  13. 4
      src/widget/date/calendar/picker.date.js
  14. 2
      src/widget/date/calendar/popup.calendar.date.js
  15. 28
      src/widget/date/trigger.date.js
  16. 4
      src/widget/datepane/datepane.js
  17. 2
      src/widget/datetime/datetime.combo.js
  18. 4
      src/widget/datetime/datetime.popup.js
  19. 4
      src/widget/datetime/datetime.trigger.js
  20. 34
      src/widget/multidate/abstract.multidate.datepane.js
  21. 4
      src/widget/multidate/multidate.combo.js
  22. 2
      src/widget/multidate/multidate.popup.js
  23. 4
      src/widget/year/popup.year.js

20
bi/case.js

@ -1643,7 +1643,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
}, },
_dateCreator: function (Y, M, D) { _dateCreator: function (Y, M, D) {
var self = this, o = this.options, log = {}, De = new Date(); var self = this, o = this.options, log = {}, De = Date.getDate();
var mins = o.min.match(/\d+/g); var mins = o.min.match(/\d+/g);
var maxs = o.max.match(/\d+/g); var maxs = o.max.match(/\d+/g);
Y < (mins[0] | 0) && (Y = (mins[0] | 0)); Y < (mins[0] | 0) && (Y = (mins[0] | 0));
@ -1753,7 +1753,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFrontDate: function () { isFrontDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(-1 * (day + 1)); var newDate = De.getOffsetDate(-1 * (day + 1));
@ -1762,7 +1762,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFinalDate: function () { isFinalDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(42 - day); var newDate = De.getOffsetDate(42 - day);
@ -1785,14 +1785,14 @@ BI.Calendar = BI.inherit(BI.Widget, {
BI.extend(BI.Calendar, { BI.extend(BI.Calendar, {
getPageByDateJSON: function (json) { getPageByDateJSON: function (json) {
var year = new Date().getFullYear(); var year = Date.getDate().getFullYear();
var month = new Date().getMonth(); var month = Date.getDate().getMonth();
var page = (json.year - year) * 12; var page = (json.year - year) * 12;
page += json.month - month; page += json.month - month;
return page; return page;
}, },
getDateJSONByPage: function(v){ getDateJSONByPage: function(v){
var months = new Date().getMonth(); var months = Date.getDate().getMonth();
var page = v; var page = v;
//对当前page做偏移,使到当前年初 //对当前page做偏移,使到当前年初
@ -1804,7 +1804,7 @@ BI.extend(BI.Calendar, {
} }
var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12);
return { return {
year: new Date().getFullYear() + year, year: Date.getDate().getFullYear() + year,
month: month month: month
} }
} }
@ -1850,7 +1850,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.YearCalendar.superclass._init.apply(this, arguments); BI.YearCalendar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.currentYear = new Date().getFullYear(); this.currentYear = Date.getDate().getFullYear();
var years = this._yearCreator(o.year || this.currentYear); var years = this._yearCreator(o.year || this.currentYear);
//纵向排列年 //纵向排列年
@ -1937,7 +1937,7 @@ BI.extend(BI.YearCalendar, {
//获取显示的第一年 //获取显示的第一年
getStartYear: function (year) { getStartYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL; return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL;
}, },
@ -1946,7 +1946,7 @@ BI.extend(BI.YearCalendar, {
}, },
getPageByYear: function (year) { getPageByYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
year = BI.YearCalendar.getStartYear(year); year = BI.YearCalendar.getStartYear(year);
return (year - cur + 3) / BI.YearCalendar.INTERVAL; return (year - cur + 3) / BI.YearCalendar.INTERVAL;
} }

77
bi/core.js

@ -11695,7 +11695,7 @@ if (!window.BI) {
// Date // Date
if (type === '[object Date]') { if (type === '[object Date]') {
return new Date(obj.getTime()); return Date.getDate(obj.getTime());
} }
var i, clone, key; var i, clone, key;
@ -11925,7 +11925,7 @@ if (!window.BI) {
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
} else { } else {
return new Date().getTime(); return Date.getDate().getTime();
} }
} }
} }
@ -20846,21 +20846,22 @@ Date.prototype.getMonthDays = function (month) {
* @returns {Date} * @returns {Date}
*/ */
Date.prototype.getLastDateOfMonth = function () { Date.prototype.getLastDateOfMonth = function () {
return new Date(this.getFullYear(), this.getMonth(), this.getMonthDays()); return Date.getDate(this.getFullYear(), this.getMonth(), this.getMonthDays());
}; };
/** Returns the number of day in the year. */ /** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function () { Date.prototype.getDayOfYear = function () {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var now = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var then = Date.getDate(this.getFullYear(), 0, 0, 0, 0, 0);
var time = now - then; var time = now - then;
return Math.floor(time / Date.DAY); return Math.floor(time / Date.DAY);
}; };
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var week = d.getDay(); //周一是一周第一天
var week = d.getDay() === 0 ? 6 : d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
@ -20869,25 +20870,29 @@ Date.prototype.getWeekNumber = function () {
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
}; };
Date.prototype.getQuarter = function () {
return Math.floor(this.getMonth() / 3) + 1;
};
//离当前时间多少天的时间 //离当前时间多少天的时间
Date.prototype.getOffsetDate = function (offset) { Date.prototype.getOffsetDate = function (offset) {
return new Date(this.getTime() + offset * 864e5); return Date.getDate(this.getTime() + offset * 864e5);
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20911,32 +20916,32 @@ Date.prototype.getQuarterStartMonth = function () {
}; };
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20961,9 +20966,9 @@ Date.prototype.getQuarterStartMonth = function () {
//指定日期n个月之前或之后的日期 //指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) { Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var day = dt.getDate(); var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); var monthDay = Date.getDate(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if (day > monthDay) { if (day > monthDay) {
day = monthDay; day = monthDay;
} }
@ -20986,31 +20991,31 @@ Date.prototype.getWeekEndDate = function () {
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
//获得当前时区对应指定时区的时间 //获得当前时区对应指定时区的时间
Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) { Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var localTime = dt.getTime(); var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数 var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区 var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + offset); return Date.getDate(utc + offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -21025,7 +21030,7 @@ Date.prototype.equalsTo = function (date) {
/** Set only the year, month, date parts (keep existing time) */ /** Set only the year, month, date parts (keep existing time) */
Date.prototype.setDateOnly = function (date) { Date.prototype.setDateOnly = function (date) {
var tmp = new Date(date); var tmp = Date.getDate(date);
this.setDate(1); this.setDate(1);
this.setFullYear(tmp.getFullYear()); this.setFullYear(tmp.getFullYear());
this.setMonth(tmp.getMonth()); this.setMonth(tmp.getMonth());
@ -21037,6 +21042,7 @@ Date.prototype.print = function (str) {
var d = this.getDate(); var d = this.getDate();
var y = this.getFullYear(); var y = this.getFullYear();
var wn = this.getWeekNumber(); var wn = this.getWeekNumber();
var qr = this.getQuarter();
var w = this.getDay(); var w = this.getDay();
var s = {}; var s = {};
var hr = this.getHours(); var hr = this.getHours();
@ -21083,6 +21089,7 @@ Date.prototype.print = function (str) {
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character s["%%"] = "%"; // a literal '%' character
s["%Q"] = qr;
var re = /%./g; var re = /%./g;
if (!BI.isKhtml()) { if (!BI.isKhtml()) {
@ -21171,7 +21178,7 @@ Date.checkLegal = function (str) {
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {
var today = new Date(); var today = Date.getDate();
var y = 0; var y = 0;
var m = 0; var m = 0;
var d = 1; var d = 1;
@ -21264,7 +21271,7 @@ Date.parseDateTime = function (str, fmt) {
sec = today.getSeconds(); sec = today.getSeconds();
} }
if (y != 0) { if (y != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
y = 0; y = 0;
m = -1; m = -1;
@ -21297,10 +21304,22 @@ Date.parseDateTime = function (str, fmt) {
y = today.getFullYear(); y = today.getFullYear();
} }
if (m != -1 && d != 0) { if (m != -1 && d != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
return today; return today;
}; };
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
if (arguments.length > 0 || BI.isNull(Date.timeZone)) {
return dt;
} else {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + Date.timeZone);//+ Pool.timeZone.offset);
}
};
/* /*
* 给jQuery.Event对象添加的工具方法 * 给jQuery.Event对象添加的工具方法
*/ */

92
bi/widget.js

@ -1946,8 +1946,8 @@ BI.DatePicker = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.DatePicker.superclass._init.apply(this, arguments); BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this._year = new Date().getFullYear(); this._year = Date.getDate().getFullYear();
this._month = new Date().getMonth(); this._month = Date.getDate().getMonth();
this.left = BI.createWidget({ this.left = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "pre-page-h-font", cls: "pre-page-h-font",
@ -2111,7 +2111,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
BI.DateCalendarPopup.superclass._init.apply(this, arguments); BI.DateCalendarPopup.superclass._init.apply(this, arguments);
var self = this, var self = this,
o = this.options; o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
this._day = this.today.getDate(); this._day = this.today.getDate();
@ -2433,7 +2433,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
setValue: function (v) { setValue: function (v) {
var type, value, self = this; var type, value, self = this;
var date = new Date(); var date = Date.getDate();
this.store_value = v; this.store_value = v;
if (BI.isNotNull(v)) { if (BI.isNotNull(v)) {
type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value; type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value;
@ -2450,62 +2450,62 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
switch (type) { switch (type) {
case BI.DateTrigger.MULTI_DATE_YEAR_PREV: case BI.DateTrigger.MULTI_DATE_YEAR_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV];
date = new Date((date.getFullYear() - 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() - 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_AFTER: case BI.DateTrigger.MULTI_DATE_YEAR_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER];
date = new Date((date.getFullYear() + 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() + 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN: case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN];
date = new Date(date.getFullYear(), 0, 1); date = Date.getDate(date.getFullYear(), 0, 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_END: case BI.DateTrigger.MULTI_DATE_YEAR_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END];
date = new Date(date.getFullYear(), 11, 31); date = Date.getDate(date.getFullYear(), 11, 31);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_PREV: case BI.DateTrigger.MULTI_DATE_QUARTER_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV];
date = new Date().getBeforeMulQuarter(value); date = Date.getDate().getBeforeMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER: case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER];
date = new Date().getAfterMulQuarter(value); date = Date.getDate().getAfterMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN: case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN];
date = new Date().getQuarterStartDate(); date = Date.getDate().getQuarterStartDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_END: case BI.DateTrigger.MULTI_DATE_QUARTER_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END];
date = new Date().getQuarterEndDate(); date = Date.getDate().getQuarterEndDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_PREV: case BI.DateTrigger.MULTI_DATE_MONTH_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV];
date = new Date().getBeforeMultiMonth(value); date = Date.getDate().getBeforeMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_AFTER: case BI.DateTrigger.MULTI_DATE_MONTH_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER];
date = new Date().getAfterMultiMonth(value); date = Date.getDate().getAfterMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN: case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN];
date = new Date(date.getFullYear(), date.getMonth(), 1); date = Date.getDate(date.getFullYear(), date.getMonth(), 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_END: case BI.DateTrigger.MULTI_DATE_MONTH_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END];
date = new Date(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate()); date = Date.getDate(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_WEEK_PREV: case BI.DateTrigger.MULTI_DATE_WEEK_PREV:
@ -2530,7 +2530,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
break; break;
case BI.DateTrigger.MULTI_DATE_DAY_TODAY: case BI.DateTrigger.MULTI_DATE_DAY_TODAY:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY];
date = new Date(); date = Date.getDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
default: default:
@ -2631,7 +2631,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
BI.DatePaneWidget.superclass._init.apply(this, arguments); BI.DatePaneWidget.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
@ -2695,7 +2695,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
}, },
_getNewCurrentDate: function () { _getNewCurrentDate: function () {
var today = new Date(); var today = Date.getDate();
return { return {
year: today.getFullYear(), year: today.getFullYear(),
month: today.getMonth() month: today.getMonth()
@ -2757,7 +2757,7 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.DateTimeCombo.superclass._init.apply(this, arguments); BI.DateTimeCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
var date = new Date(); var date = Date.getDate();
this.storeValue = { this.storeValue = {
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -2974,7 +2974,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
}] }]
}); });
var date = new Date(); var date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -3006,7 +3006,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var value = v, date; var value = v, date;
if (BI.isNull(value)) { if (BI.isNull(value)) {
date = new Date(); date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -3196,10 +3196,10 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, {
var self = this; var self = this;
var value = v, dateStr; var value = v, dateStr;
if(BI.isNull(value)){ if(BI.isNull(value)){
value = new Date(); value = Date.getDate();
dateStr = value.print("%Y-%X-%d %H:%M:%S"); dateStr = value.print("%Y-%X-%d %H:%M:%S");
} else { } else {
var date = new Date(value.year,value.month,value.day,value.hour,value.minute,value.second); var date = Date.getDate(value.year,value.month,value.day,value.hour,value.minute,value.second);
dateStr = date.print("%Y-%X-%d %H:%M:%S"); dateStr = date.print("%Y-%X-%d %H:%M:%S");
} }
@ -6741,39 +6741,39 @@ BI.MultiDateCard = BI.inherit(BI.Widget, {
var type = valueObject.type, value = valueObject.value; var type = valueObject.type, value = valueObject.value;
switch (type) { switch (type) {
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV:
return new Date().getOffsetDate(-1 * value); return Date.getDate().getOffsetDate(-1 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER:
return new Date().getOffsetDate(value); return Date.getDate().getOffsetDate(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY:
return new Date(); return Date.getDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV:
return new Date().getBeforeMultiMonth(value); return Date.getDate().getBeforeMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER:
return new Date().getAfterMultiMonth(value); return Date.getDate().getAfterMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN:
return new Date(new Date().getFullYear(), new Date().getMonth(), 1); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END:
return new Date(new Date().getFullYear(), new Date().getMonth(), (new Date().getLastDateOfMonth()).getDate()); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), (Date.getDate().getLastDateOfMonth()).getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV:
return new Date().getBeforeMulQuarter(value); return Date.getDate().getBeforeMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER:
return new Date().getAfterMulQuarter(value); return Date.getDate().getAfterMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN:
return new Date().getQuarterStartDate(); return Date.getDate().getQuarterStartDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END:
return new Date().getQuarterEndDate(); return Date.getDate().getQuarterEndDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV:
return new Date().getOffsetDate(-7 * value); return Date.getDate().getOffsetDate(-7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER:
return new Date().getOffsetDate(7 * value); return Date.getDate().getOffsetDate(7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV:
return new Date((new Date().getFullYear() - 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() - 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER:
return new Date((new Date().getFullYear() + 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() + 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN:
return new Date(new Date().getFullYear(), 0, 1); return Date.getDate(Date.getDate().getFullYear(), 0, 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END:
return new Date(new Date().getFullYear(), 11, 31); return Date.getDate(Date.getDate().getFullYear(), 11, 31);
} }
} }
}); });
@ -6802,7 +6802,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
BI.MultiDateCombo.superclass._init.apply(this, arguments); BI.MultiDateCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = ""; this.storeTriggerValue = "";
var date = new Date(); var date = Date.getDate();
this.storeValue = null; this.storeValue = null;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: 'bi.date_trigger', type: 'bi.date_trigger',
@ -6869,7 +6869,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
}); });
this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () { this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () {
var date = new Date(); var date = Date.getDate();
self.setValue({ self.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -7425,7 +7425,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, {
break; break;
default: default:
if (this._checkValueValid(value)) { if (this._checkValueValid(value)) {
var date = new Date(); var date = Date.getDate();
this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD);
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
@ -18618,7 +18618,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
BI.YearPopup.superclass._init.apply(this, arguments); BI.YearPopup.superclass._init.apply(this, arguments);
var self = this; var self = this;
this.selectedYear = this._year = new Date().getFullYear(); this.selectedYear = this._year = Date.getDate().getFullYear();
var backBtn = BI.createWidget({ var backBtn = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
@ -18672,7 +18672,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var o = this.options; var o = this.options;
if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) { if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) {
v = new Date().getFullYear(); v = Date.getDate().getFullYear();
this.selectedYear = ""; this.selectedYear = "";
this.navigation.setSelect(BI.YearCalendar.getPageByYear(v)); this.navigation.setSelect(BI.YearCalendar.getPageByYear(v));
this.navigation.setValue(""); this.navigation.setValue("");

189
dist/bundle.js vendored

@ -11695,7 +11695,7 @@ if (!window.BI) {
// Date // Date
if (type === '[object Date]') { if (type === '[object Date]') {
return new Date(obj.getTime()); return Date.getDate(obj.getTime());
} }
var i, clone, key; var i, clone, key;
@ -11925,7 +11925,7 @@ if (!window.BI) {
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
} else { } else {
return new Date().getTime(); return Date.getDate().getTime();
} }
} }
} }
@ -20846,21 +20846,22 @@ Date.prototype.getMonthDays = function (month) {
* @returns {Date} * @returns {Date}
*/ */
Date.prototype.getLastDateOfMonth = function () { Date.prototype.getLastDateOfMonth = function () {
return new Date(this.getFullYear(), this.getMonth(), this.getMonthDays()); return Date.getDate(this.getFullYear(), this.getMonth(), this.getMonthDays());
}; };
/** Returns the number of day in the year. */ /** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function () { Date.prototype.getDayOfYear = function () {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var now = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var then = Date.getDate(this.getFullYear(), 0, 0, 0, 0, 0);
var time = now - then; var time = now - then;
return Math.floor(time / Date.DAY); return Math.floor(time / Date.DAY);
}; };
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var week = d.getDay(); //周一是一周第一天
var week = d.getDay() === 0 ? 6 : d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
@ -20869,25 +20870,29 @@ Date.prototype.getWeekNumber = function () {
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
}; };
Date.prototype.getQuarter = function () {
return Math.floor(this.getMonth() / 3) + 1;
};
//离当前时间多少天的时间 //离当前时间多少天的时间
Date.prototype.getOffsetDate = function (offset) { Date.prototype.getOffsetDate = function (offset) {
return new Date(this.getTime() + offset * 864e5); return Date.getDate(this.getTime() + offset * 864e5);
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20911,32 +20916,32 @@ Date.prototype.getQuarterStartMonth = function () {
}; };
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20961,9 +20966,9 @@ Date.prototype.getQuarterStartMonth = function () {
//指定日期n个月之前或之后的日期 //指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) { Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var day = dt.getDate(); var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); var monthDay = Date.getDate(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if (day > monthDay) { if (day > monthDay) {
day = monthDay; day = monthDay;
} }
@ -20986,31 +20991,31 @@ Date.prototype.getWeekEndDate = function () {
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
//获得当前时区对应指定时区的时间 //获得当前时区对应指定时区的时间
Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) { Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var localTime = dt.getTime(); var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数 var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区 var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + offset); return Date.getDate(utc + offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -21025,7 +21030,7 @@ Date.prototype.equalsTo = function (date) {
/** Set only the year, month, date parts (keep existing time) */ /** Set only the year, month, date parts (keep existing time) */
Date.prototype.setDateOnly = function (date) { Date.prototype.setDateOnly = function (date) {
var tmp = new Date(date); var tmp = Date.getDate(date);
this.setDate(1); this.setDate(1);
this.setFullYear(tmp.getFullYear()); this.setFullYear(tmp.getFullYear());
this.setMonth(tmp.getMonth()); this.setMonth(tmp.getMonth());
@ -21037,6 +21042,7 @@ Date.prototype.print = function (str) {
var d = this.getDate(); var d = this.getDate();
var y = this.getFullYear(); var y = this.getFullYear();
var wn = this.getWeekNumber(); var wn = this.getWeekNumber();
var qr = this.getQuarter();
var w = this.getDay(); var w = this.getDay();
var s = {}; var s = {};
var hr = this.getHours(); var hr = this.getHours();
@ -21083,6 +21089,7 @@ Date.prototype.print = function (str) {
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character s["%%"] = "%"; // a literal '%' character
s["%Q"] = qr;
var re = /%./g; var re = /%./g;
if (!BI.isKhtml()) { if (!BI.isKhtml()) {
@ -21171,7 +21178,7 @@ Date.checkLegal = function (str) {
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {
var today = new Date(); var today = Date.getDate();
var y = 0; var y = 0;
var m = 0; var m = 0;
var d = 1; var d = 1;
@ -21264,7 +21271,7 @@ Date.parseDateTime = function (str, fmt) {
sec = today.getSeconds(); sec = today.getSeconds();
} }
if (y != 0) { if (y != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
y = 0; y = 0;
m = -1; m = -1;
@ -21297,10 +21304,22 @@ Date.parseDateTime = function (str, fmt) {
y = today.getFullYear(); y = today.getFullYear();
} }
if (m != -1 && d != 0) { if (m != -1 && d != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
return today; return today;
}; };
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
if (arguments.length > 0 || BI.isNull(Date.timeZone)) {
return dt;
} else {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + Date.timeZone);//+ Pool.timeZone.offset);
}
};
/* /*
* 给jQuery.Event对象添加的工具方法 * 给jQuery.Event对象添加的工具方法
*/ */
@ -63100,7 +63119,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
}, },
_dateCreator: function (Y, M, D) { _dateCreator: function (Y, M, D) {
var self = this, o = this.options, log = {}, De = new Date(); var self = this, o = this.options, log = {}, De = Date.getDate();
var mins = o.min.match(/\d+/g); var mins = o.min.match(/\d+/g);
var maxs = o.max.match(/\d+/g); var maxs = o.max.match(/\d+/g);
Y < (mins[0] | 0) && (Y = (mins[0] | 0)); Y < (mins[0] | 0) && (Y = (mins[0] | 0));
@ -63210,7 +63229,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFrontDate: function () { isFrontDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(-1 * (day + 1)); var newDate = De.getOffsetDate(-1 * (day + 1));
@ -63219,7 +63238,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFinalDate: function () { isFinalDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(42 - day); var newDate = De.getOffsetDate(42 - day);
@ -63242,14 +63261,14 @@ BI.Calendar = BI.inherit(BI.Widget, {
BI.extend(BI.Calendar, { BI.extend(BI.Calendar, {
getPageByDateJSON: function (json) { getPageByDateJSON: function (json) {
var year = new Date().getFullYear(); var year = Date.getDate().getFullYear();
var month = new Date().getMonth(); var month = Date.getDate().getMonth();
var page = (json.year - year) * 12; var page = (json.year - year) * 12;
page += json.month - month; page += json.month - month;
return page; return page;
}, },
getDateJSONByPage: function(v){ getDateJSONByPage: function(v){
var months = new Date().getMonth(); var months = Date.getDate().getMonth();
var page = v; var page = v;
//对当前page做偏移,使到当前年初 //对当前page做偏移,使到当前年初
@ -63261,7 +63280,7 @@ BI.extend(BI.Calendar, {
} }
var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12);
return { return {
year: new Date().getFullYear() + year, year: Date.getDate().getFullYear() + year,
month: month month: month
} }
} }
@ -63307,7 +63326,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.YearCalendar.superclass._init.apply(this, arguments); BI.YearCalendar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.currentYear = new Date().getFullYear(); this.currentYear = Date.getDate().getFullYear();
var years = this._yearCreator(o.year || this.currentYear); var years = this._yearCreator(o.year || this.currentYear);
//纵向排列年 //纵向排列年
@ -63394,7 +63413,7 @@ BI.extend(BI.YearCalendar, {
//获取显示的第一年 //获取显示的第一年
getStartYear: function (year) { getStartYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL; return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL;
}, },
@ -63403,7 +63422,7 @@ BI.extend(BI.YearCalendar, {
}, },
getPageByYear: function (year) { getPageByYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
year = BI.YearCalendar.getStartYear(year); year = BI.YearCalendar.getStartYear(year);
return (year - cur + 3) / BI.YearCalendar.INTERVAL; return (year - cur + 3) / BI.YearCalendar.INTERVAL;
} }
@ -77170,8 +77189,8 @@ BI.DatePicker = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.DatePicker.superclass._init.apply(this, arguments); BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this._year = new Date().getFullYear(); this._year = Date.getDate().getFullYear();
this._month = new Date().getMonth(); this._month = Date.getDate().getMonth();
this.left = BI.createWidget({ this.left = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "pre-page-h-font", cls: "pre-page-h-font",
@ -77335,7 +77354,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
BI.DateCalendarPopup.superclass._init.apply(this, arguments); BI.DateCalendarPopup.superclass._init.apply(this, arguments);
var self = this, var self = this,
o = this.options; o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
this._day = this.today.getDate(); this._day = this.today.getDate();
@ -77657,7 +77676,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
setValue: function (v) { setValue: function (v) {
var type, value, self = this; var type, value, self = this;
var date = new Date(); var date = Date.getDate();
this.store_value = v; this.store_value = v;
if (BI.isNotNull(v)) { if (BI.isNotNull(v)) {
type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value; type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value;
@ -77674,62 +77693,62 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
switch (type) { switch (type) {
case BI.DateTrigger.MULTI_DATE_YEAR_PREV: case BI.DateTrigger.MULTI_DATE_YEAR_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV];
date = new Date((date.getFullYear() - 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() - 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_AFTER: case BI.DateTrigger.MULTI_DATE_YEAR_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER];
date = new Date((date.getFullYear() + 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() + 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN: case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN];
date = new Date(date.getFullYear(), 0, 1); date = Date.getDate(date.getFullYear(), 0, 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_END: case BI.DateTrigger.MULTI_DATE_YEAR_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END];
date = new Date(date.getFullYear(), 11, 31); date = Date.getDate(date.getFullYear(), 11, 31);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_PREV: case BI.DateTrigger.MULTI_DATE_QUARTER_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV];
date = new Date().getBeforeMulQuarter(value); date = Date.getDate().getBeforeMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER: case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER];
date = new Date().getAfterMulQuarter(value); date = Date.getDate().getAfterMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN: case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN];
date = new Date().getQuarterStartDate(); date = Date.getDate().getQuarterStartDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_END: case BI.DateTrigger.MULTI_DATE_QUARTER_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END];
date = new Date().getQuarterEndDate(); date = Date.getDate().getQuarterEndDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_PREV: case BI.DateTrigger.MULTI_DATE_MONTH_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV];
date = new Date().getBeforeMultiMonth(value); date = Date.getDate().getBeforeMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_AFTER: case BI.DateTrigger.MULTI_DATE_MONTH_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER];
date = new Date().getAfterMultiMonth(value); date = Date.getDate().getAfterMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN: case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN];
date = new Date(date.getFullYear(), date.getMonth(), 1); date = Date.getDate(date.getFullYear(), date.getMonth(), 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_END: case BI.DateTrigger.MULTI_DATE_MONTH_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END];
date = new Date(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate()); date = Date.getDate(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_WEEK_PREV: case BI.DateTrigger.MULTI_DATE_WEEK_PREV:
@ -77754,7 +77773,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
break; break;
case BI.DateTrigger.MULTI_DATE_DAY_TODAY: case BI.DateTrigger.MULTI_DATE_DAY_TODAY:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY];
date = new Date(); date = Date.getDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
default: default:
@ -77855,7 +77874,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
BI.DatePaneWidget.superclass._init.apply(this, arguments); BI.DatePaneWidget.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
@ -77919,7 +77938,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
}, },
_getNewCurrentDate: function () { _getNewCurrentDate: function () {
var today = new Date(); var today = Date.getDate();
return { return {
year: today.getFullYear(), year: today.getFullYear(),
month: today.getMonth() month: today.getMonth()
@ -77981,7 +78000,7 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.DateTimeCombo.superclass._init.apply(this, arguments); BI.DateTimeCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
var date = new Date(); var date = Date.getDate();
this.storeValue = { this.storeValue = {
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -78198,7 +78217,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
}] }]
}); });
var date = new Date(); var date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -78230,7 +78249,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var value = v, date; var value = v, date;
if (BI.isNull(value)) { if (BI.isNull(value)) {
date = new Date(); date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -78420,10 +78439,10 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, {
var self = this; var self = this;
var value = v, dateStr; var value = v, dateStr;
if(BI.isNull(value)){ if(BI.isNull(value)){
value = new Date(); value = Date.getDate();
dateStr = value.print("%Y-%X-%d %H:%M:%S"); dateStr = value.print("%Y-%X-%d %H:%M:%S");
} else { } else {
var date = new Date(value.year,value.month,value.day,value.hour,value.minute,value.second); var date = Date.getDate(value.year,value.month,value.day,value.hour,value.minute,value.second);
dateStr = date.print("%Y-%X-%d %H:%M:%S"); dateStr = date.print("%Y-%X-%d %H:%M:%S");
} }
@ -81965,39 +81984,39 @@ BI.MultiDateCard = BI.inherit(BI.Widget, {
var type = valueObject.type, value = valueObject.value; var type = valueObject.type, value = valueObject.value;
switch (type) { switch (type) {
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV:
return new Date().getOffsetDate(-1 * value); return Date.getDate().getOffsetDate(-1 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER:
return new Date().getOffsetDate(value); return Date.getDate().getOffsetDate(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY:
return new Date(); return Date.getDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV:
return new Date().getBeforeMultiMonth(value); return Date.getDate().getBeforeMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER:
return new Date().getAfterMultiMonth(value); return Date.getDate().getAfterMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN:
return new Date(new Date().getFullYear(), new Date().getMonth(), 1); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END:
return new Date(new Date().getFullYear(), new Date().getMonth(), (new Date().getLastDateOfMonth()).getDate()); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), (Date.getDate().getLastDateOfMonth()).getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV:
return new Date().getBeforeMulQuarter(value); return Date.getDate().getBeforeMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER:
return new Date().getAfterMulQuarter(value); return Date.getDate().getAfterMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN:
return new Date().getQuarterStartDate(); return Date.getDate().getQuarterStartDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END:
return new Date().getQuarterEndDate(); return Date.getDate().getQuarterEndDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV:
return new Date().getOffsetDate(-7 * value); return Date.getDate().getOffsetDate(-7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER:
return new Date().getOffsetDate(7 * value); return Date.getDate().getOffsetDate(7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV:
return new Date((new Date().getFullYear() - 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() - 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER:
return new Date((new Date().getFullYear() + 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() + 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN:
return new Date(new Date().getFullYear(), 0, 1); return Date.getDate(Date.getDate().getFullYear(), 0, 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END:
return new Date(new Date().getFullYear(), 11, 31); return Date.getDate(Date.getDate().getFullYear(), 11, 31);
} }
} }
}); });
@ -82026,7 +82045,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
BI.MultiDateCombo.superclass._init.apply(this, arguments); BI.MultiDateCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = ""; this.storeTriggerValue = "";
var date = new Date(); var date = Date.getDate();
this.storeValue = null; this.storeValue = null;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: 'bi.date_trigger', type: 'bi.date_trigger',
@ -82093,7 +82112,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
}); });
this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () { this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () {
var date = new Date(); var date = Date.getDate();
self.setValue({ self.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -82649,7 +82668,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, {
break; break;
default: default:
if (this._checkValueValid(value)) { if (this._checkValueValid(value)) {
var date = new Date(); var date = Date.getDate();
this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD);
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
@ -93842,7 +93861,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
BI.YearPopup.superclass._init.apply(this, arguments); BI.YearPopup.superclass._init.apply(this, arguments);
var self = this; var self = this;
this.selectedYear = this._year = new Date().getFullYear(); this.selectedYear = this._year = Date.getDate().getFullYear();
var backBtn = BI.createWidget({ var backBtn = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
@ -93896,7 +93915,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var o = this.options; var o = this.options;
if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) { if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) {
v = new Date().getFullYear(); v = Date.getDate().getFullYear();
this.selectedYear = ""; this.selectedYear = "";
this.navigation.setSelect(BI.YearCalendar.getPageByYear(v)); this.navigation.setSelect(BI.YearCalendar.getPageByYear(v));
this.navigation.setValue(""); this.navigation.setValue("");

82
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

20
dist/case.js vendored

@ -1643,7 +1643,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
}, },
_dateCreator: function (Y, M, D) { _dateCreator: function (Y, M, D) {
var self = this, o = this.options, log = {}, De = new Date(); var self = this, o = this.options, log = {}, De = Date.getDate();
var mins = o.min.match(/\d+/g); var mins = o.min.match(/\d+/g);
var maxs = o.max.match(/\d+/g); var maxs = o.max.match(/\d+/g);
Y < (mins[0] | 0) && (Y = (mins[0] | 0)); Y < (mins[0] | 0) && (Y = (mins[0] | 0));
@ -1753,7 +1753,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFrontDate: function () { isFrontDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(-1 * (day + 1)); var newDate = De.getOffsetDate(-1 * (day + 1));
@ -1762,7 +1762,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFinalDate: function () { isFinalDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(42 - day); var newDate = De.getOffsetDate(42 - day);
@ -1785,14 +1785,14 @@ BI.Calendar = BI.inherit(BI.Widget, {
BI.extend(BI.Calendar, { BI.extend(BI.Calendar, {
getPageByDateJSON: function (json) { getPageByDateJSON: function (json) {
var year = new Date().getFullYear(); var year = Date.getDate().getFullYear();
var month = new Date().getMonth(); var month = Date.getDate().getMonth();
var page = (json.year - year) * 12; var page = (json.year - year) * 12;
page += json.month - month; page += json.month - month;
return page; return page;
}, },
getDateJSONByPage: function(v){ getDateJSONByPage: function(v){
var months = new Date().getMonth(); var months = Date.getDate().getMonth();
var page = v; var page = v;
//对当前page做偏移,使到当前年初 //对当前page做偏移,使到当前年初
@ -1804,7 +1804,7 @@ BI.extend(BI.Calendar, {
} }
var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12);
return { return {
year: new Date().getFullYear() + year, year: Date.getDate().getFullYear() + year,
month: month month: month
} }
} }
@ -1850,7 +1850,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.YearCalendar.superclass._init.apply(this, arguments); BI.YearCalendar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.currentYear = new Date().getFullYear(); this.currentYear = Date.getDate().getFullYear();
var years = this._yearCreator(o.year || this.currentYear); var years = this._yearCreator(o.year || this.currentYear);
//纵向排列年 //纵向排列年
@ -1937,7 +1937,7 @@ BI.extend(BI.YearCalendar, {
//获取显示的第一年 //获取显示的第一年
getStartYear: function (year) { getStartYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL; return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL;
}, },
@ -1946,7 +1946,7 @@ BI.extend(BI.YearCalendar, {
}, },
getPageByYear: function (year) { getPageByYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
year = BI.YearCalendar.getStartYear(year); year = BI.YearCalendar.getStartYear(year);
return (year - cur + 3) / BI.YearCalendar.INTERVAL; return (year - cur + 3) / BI.YearCalendar.INTERVAL;
} }

77
dist/core.js vendored

@ -11695,7 +11695,7 @@ if (!window.BI) {
// Date // Date
if (type === '[object Date]') { if (type === '[object Date]') {
return new Date(obj.getTime()); return Date.getDate(obj.getTime());
} }
var i, clone, key; var i, clone, key;
@ -11925,7 +11925,7 @@ if (!window.BI) {
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
} else { } else {
return new Date().getTime(); return Date.getDate().getTime();
} }
} }
} }
@ -20846,21 +20846,22 @@ Date.prototype.getMonthDays = function (month) {
* @returns {Date} * @returns {Date}
*/ */
Date.prototype.getLastDateOfMonth = function () { Date.prototype.getLastDateOfMonth = function () {
return new Date(this.getFullYear(), this.getMonth(), this.getMonthDays()); return Date.getDate(this.getFullYear(), this.getMonth(), this.getMonthDays());
}; };
/** Returns the number of day in the year. */ /** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function () { Date.prototype.getDayOfYear = function () {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var now = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var then = Date.getDate(this.getFullYear(), 0, 0, 0, 0, 0);
var time = now - then; var time = now - then;
return Math.floor(time / Date.DAY); return Math.floor(time / Date.DAY);
}; };
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var week = d.getDay(); //周一是一周第一天
var week = d.getDay() === 0 ? 6 : d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
@ -20869,25 +20870,29 @@ Date.prototype.getWeekNumber = function () {
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
}; };
Date.prototype.getQuarter = function () {
return Math.floor(this.getMonth() / 3) + 1;
};
//离当前时间多少天的时间 //离当前时间多少天的时间
Date.prototype.getOffsetDate = function (offset) { Date.prototype.getOffsetDate = function (offset) {
return new Date(this.getTime() + offset * 864e5); return Date.getDate(this.getTime() + offset * 864e5);
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20911,32 +20916,32 @@ Date.prototype.getQuarterStartMonth = function () {
}; };
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -20961,9 +20966,9 @@ Date.prototype.getQuarterStartMonth = function () {
//指定日期n个月之前或之后的日期 //指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) { Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var day = dt.getDate(); var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); var monthDay = Date.getDate(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if (day > monthDay) { if (day > monthDay) {
day = monthDay; day = monthDay;
} }
@ -20986,31 +20991,31 @@ Date.prototype.getWeekEndDate = function () {
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
//获得当前时区对应指定时区的时间 //获得当前时区对应指定时区的时间
Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) { Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var localTime = dt.getTime(); var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数 var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区 var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + offset); return Date.getDate(utc + offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -21025,7 +21030,7 @@ Date.prototype.equalsTo = function (date) {
/** Set only the year, month, date parts (keep existing time) */ /** Set only the year, month, date parts (keep existing time) */
Date.prototype.setDateOnly = function (date) { Date.prototype.setDateOnly = function (date) {
var tmp = new Date(date); var tmp = Date.getDate(date);
this.setDate(1); this.setDate(1);
this.setFullYear(tmp.getFullYear()); this.setFullYear(tmp.getFullYear());
this.setMonth(tmp.getMonth()); this.setMonth(tmp.getMonth());
@ -21037,6 +21042,7 @@ Date.prototype.print = function (str) {
var d = this.getDate(); var d = this.getDate();
var y = this.getFullYear(); var y = this.getFullYear();
var wn = this.getWeekNumber(); var wn = this.getWeekNumber();
var qr = this.getQuarter();
var w = this.getDay(); var w = this.getDay();
var s = {}; var s = {};
var hr = this.getHours(); var hr = this.getHours();
@ -21083,6 +21089,7 @@ Date.prototype.print = function (str) {
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character s["%%"] = "%"; // a literal '%' character
s["%Q"] = qr;
var re = /%./g; var re = /%./g;
if (!BI.isKhtml()) { if (!BI.isKhtml()) {
@ -21171,7 +21178,7 @@ Date.checkLegal = function (str) {
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {
var today = new Date(); var today = Date.getDate();
var y = 0; var y = 0;
var m = 0; var m = 0;
var d = 1; var d = 1;
@ -21264,7 +21271,7 @@ Date.parseDateTime = function (str, fmt) {
sec = today.getSeconds(); sec = today.getSeconds();
} }
if (y != 0) { if (y != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
y = 0; y = 0;
m = -1; m = -1;
@ -21297,10 +21304,22 @@ Date.parseDateTime = function (str, fmt) {
y = today.getFullYear(); y = today.getFullYear();
} }
if (m != -1 && d != 0) { if (m != -1 && d != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
return today; return today;
}; };
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
if (arguments.length > 0 || BI.isNull(Date.timeZone)) {
return dt;
} else {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + Date.timeZone);//+ Pool.timeZone.offset);
}
};
/* /*
* 给jQuery.Event对象添加的工具方法 * 给jQuery.Event对象添加的工具方法
*/ */

92
dist/widget.js vendored

@ -1946,8 +1946,8 @@ BI.DatePicker = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.DatePicker.superclass._init.apply(this, arguments); BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this._year = new Date().getFullYear(); this._year = Date.getDate().getFullYear();
this._month = new Date().getMonth(); this._month = Date.getDate().getMonth();
this.left = BI.createWidget({ this.left = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "pre-page-h-font", cls: "pre-page-h-font",
@ -2111,7 +2111,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
BI.DateCalendarPopup.superclass._init.apply(this, arguments); BI.DateCalendarPopup.superclass._init.apply(this, arguments);
var self = this, var self = this,
o = this.options; o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
this._day = this.today.getDate(); this._day = this.today.getDate();
@ -2433,7 +2433,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
setValue: function (v) { setValue: function (v) {
var type, value, self = this; var type, value, self = this;
var date = new Date(); var date = Date.getDate();
this.store_value = v; this.store_value = v;
if (BI.isNotNull(v)) { if (BI.isNotNull(v)) {
type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value; type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value;
@ -2450,62 +2450,62 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
switch (type) { switch (type) {
case BI.DateTrigger.MULTI_DATE_YEAR_PREV: case BI.DateTrigger.MULTI_DATE_YEAR_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV];
date = new Date((date.getFullYear() - 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() - 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_AFTER: case BI.DateTrigger.MULTI_DATE_YEAR_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER];
date = new Date((date.getFullYear() + 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() + 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN: case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN];
date = new Date(date.getFullYear(), 0, 1); date = Date.getDate(date.getFullYear(), 0, 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_END: case BI.DateTrigger.MULTI_DATE_YEAR_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END];
date = new Date(date.getFullYear(), 11, 31); date = Date.getDate(date.getFullYear(), 11, 31);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_PREV: case BI.DateTrigger.MULTI_DATE_QUARTER_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV];
date = new Date().getBeforeMulQuarter(value); date = Date.getDate().getBeforeMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER: case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER];
date = new Date().getAfterMulQuarter(value); date = Date.getDate().getAfterMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN: case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN];
date = new Date().getQuarterStartDate(); date = Date.getDate().getQuarterStartDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_END: case BI.DateTrigger.MULTI_DATE_QUARTER_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END];
date = new Date().getQuarterEndDate(); date = Date.getDate().getQuarterEndDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_PREV: case BI.DateTrigger.MULTI_DATE_MONTH_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV];
date = new Date().getBeforeMultiMonth(value); date = Date.getDate().getBeforeMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_AFTER: case BI.DateTrigger.MULTI_DATE_MONTH_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER];
date = new Date().getAfterMultiMonth(value); date = Date.getDate().getAfterMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN: case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN];
date = new Date(date.getFullYear(), date.getMonth(), 1); date = Date.getDate(date.getFullYear(), date.getMonth(), 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_END: case BI.DateTrigger.MULTI_DATE_MONTH_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END];
date = new Date(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate()); date = Date.getDate(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_WEEK_PREV: case BI.DateTrigger.MULTI_DATE_WEEK_PREV:
@ -2530,7 +2530,7 @@ BI.shortcut('bi.date_combo', BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge
break; break;
case BI.DateTrigger.MULTI_DATE_DAY_TODAY: case BI.DateTrigger.MULTI_DATE_DAY_TODAY:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY];
date = new Date(); date = Date.getDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
default: default:
@ -2631,7 +2631,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
BI.DatePaneWidget.superclass._init.apply(this, arguments); BI.DatePaneWidget.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
@ -2695,7 +2695,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
}, },
_getNewCurrentDate: function () { _getNewCurrentDate: function () {
var today = new Date(); var today = Date.getDate();
return { return {
year: today.getFullYear(), year: today.getFullYear(),
month: today.getMonth() month: today.getMonth()
@ -2757,7 +2757,7 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.DateTimeCombo.superclass._init.apply(this, arguments); BI.DateTimeCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
var date = new Date(); var date = Date.getDate();
this.storeValue = { this.storeValue = {
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -2974,7 +2974,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
}] }]
}); });
var date = new Date(); var date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -3006,7 +3006,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var value = v, date; var value = v, date;
if (BI.isNull(value)) { if (BI.isNull(value)) {
date = new Date(); date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -3196,10 +3196,10 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, {
var self = this; var self = this;
var value = v, dateStr; var value = v, dateStr;
if(BI.isNull(value)){ if(BI.isNull(value)){
value = new Date(); value = Date.getDate();
dateStr = value.print("%Y-%X-%d %H:%M:%S"); dateStr = value.print("%Y-%X-%d %H:%M:%S");
} else { } else {
var date = new Date(value.year,value.month,value.day,value.hour,value.minute,value.second); var date = Date.getDate(value.year,value.month,value.day,value.hour,value.minute,value.second);
dateStr = date.print("%Y-%X-%d %H:%M:%S"); dateStr = date.print("%Y-%X-%d %H:%M:%S");
} }
@ -6741,39 +6741,39 @@ BI.MultiDateCard = BI.inherit(BI.Widget, {
var type = valueObject.type, value = valueObject.value; var type = valueObject.type, value = valueObject.value;
switch (type) { switch (type) {
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV:
return new Date().getOffsetDate(-1 * value); return Date.getDate().getOffsetDate(-1 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER:
return new Date().getOffsetDate(value); return Date.getDate().getOffsetDate(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY:
return new Date(); return Date.getDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV:
return new Date().getBeforeMultiMonth(value); return Date.getDate().getBeforeMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER:
return new Date().getAfterMultiMonth(value); return Date.getDate().getAfterMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN:
return new Date(new Date().getFullYear(), new Date().getMonth(), 1); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END:
return new Date(new Date().getFullYear(), new Date().getMonth(), (new Date().getLastDateOfMonth()).getDate()); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), (Date.getDate().getLastDateOfMonth()).getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV:
return new Date().getBeforeMulQuarter(value); return Date.getDate().getBeforeMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER:
return new Date().getAfterMulQuarter(value); return Date.getDate().getAfterMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN:
return new Date().getQuarterStartDate(); return Date.getDate().getQuarterStartDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END:
return new Date().getQuarterEndDate(); return Date.getDate().getQuarterEndDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV:
return new Date().getOffsetDate(-7 * value); return Date.getDate().getOffsetDate(-7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER:
return new Date().getOffsetDate(7 * value); return Date.getDate().getOffsetDate(7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV:
return new Date((new Date().getFullYear() - 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() - 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER:
return new Date((new Date().getFullYear() + 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() + 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN:
return new Date(new Date().getFullYear(), 0, 1); return Date.getDate(Date.getDate().getFullYear(), 0, 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END:
return new Date(new Date().getFullYear(), 11, 31); return Date.getDate(Date.getDate().getFullYear(), 11, 31);
} }
} }
}); });
@ -6802,7 +6802,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
BI.MultiDateCombo.superclass._init.apply(this, arguments); BI.MultiDateCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = ""; this.storeTriggerValue = "";
var date = new Date(); var date = Date.getDate();
this.storeValue = null; this.storeValue = null;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: 'bi.date_trigger', type: 'bi.date_trigger',
@ -6869,7 +6869,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
}); });
this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () { this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () {
var date = new Date(); var date = Date.getDate();
self.setValue({ self.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -7425,7 +7425,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, {
break; break;
default: default:
if (this._checkValueValid(value)) { if (this._checkValueValid(value)) {
var date = new Date(); var date = Date.getDate();
this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD);
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),
@ -18618,7 +18618,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
BI.YearPopup.superclass._init.apply(this, arguments); BI.YearPopup.superclass._init.apply(this, arguments);
var self = this; var self = this;
this.selectedYear = this._year = new Date().getFullYear(); this.selectedYear = this._year = Date.getDate().getFullYear();
var backBtn = BI.createWidget({ var backBtn = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
@ -18672,7 +18672,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var o = this.options; var o = this.options;
if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) { if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) {
v = new Date().getFullYear(); v = Date.getDate().getFullYear();
this.selectedYear = ""; this.selectedYear = "";
this.navigation.setSelect(BI.YearCalendar.getPageByYear(v)); this.navigation.setSelect(BI.YearCalendar.getPageByYear(v));
this.navigation.setValue(""); this.navigation.setValue("");

14
src/case/calendar/calendar.js

@ -20,7 +20,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
}, },
_dateCreator: function (Y, M, D) { _dateCreator: function (Y, M, D) {
var self = this, o = this.options, log = {}, De = new Date(); var self = this, o = this.options, log = {}, De = Date.getDate();
var mins = o.min.match(/\d+/g); var mins = o.min.match(/\d+/g);
var maxs = o.max.match(/\d+/g); var maxs = o.max.match(/\d+/g);
Y < (mins[0] | 0) && (Y = (mins[0] | 0)); Y < (mins[0] | 0) && (Y = (mins[0] | 0));
@ -130,7 +130,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFrontDate: function () { isFrontDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(-1 * (day + 1)); var newDate = De.getOffsetDate(-1 * (day + 1));
@ -139,7 +139,7 @@ BI.Calendar = BI.inherit(BI.Widget, {
isFinalDate: function () { isFinalDate: function () {
var o = this.options, c = this._const; var o = this.options, c = this._const;
var Y = o.year, M = o.month, De = new Date(), day = De.getDay(); var Y = o.year, M = o.month, De = Date.getDate(), day = De.getDay();
Y = Y | 0; Y = Y | 0;
De.setFullYear(Y, M, 1); De.setFullYear(Y, M, 1);
var newDate = De.getOffsetDate(42 - day); var newDate = De.getOffsetDate(42 - day);
@ -162,14 +162,14 @@ BI.Calendar = BI.inherit(BI.Widget, {
BI.extend(BI.Calendar, { BI.extend(BI.Calendar, {
getPageByDateJSON: function (json) { getPageByDateJSON: function (json) {
var year = new Date().getFullYear(); var year = Date.getDate().getFullYear();
var month = new Date().getMonth(); var month = Date.getDate().getMonth();
var page = (json.year - year) * 12; var page = (json.year - year) * 12;
page += json.month - month; page += json.month - month;
return page; return page;
}, },
getDateJSONByPage: function(v){ getDateJSONByPage: function(v){
var months = new Date().getMonth(); var months = Date.getDate().getMonth();
var page = v; var page = v;
//对当前page做偏移,使到当前年初 //对当前page做偏移,使到当前年初
@ -181,7 +181,7 @@ BI.extend(BI.Calendar, {
} }
var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12); var month = page >= 0 ? (page % 12) : ((12 + page % 12) % 12);
return { return {
year: new Date().getFullYear() + year, year: Date.getDate().getFullYear() + year,
month: month month: month
} }
} }

6
src/case/calendar/calendar.year.js

@ -38,7 +38,7 @@ BI.YearCalendar = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.YearCalendar.superclass._init.apply(this, arguments); BI.YearCalendar.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.currentYear = new Date().getFullYear(); this.currentYear = Date.getDate().getFullYear();
var years = this._yearCreator(o.year || this.currentYear); var years = this._yearCreator(o.year || this.currentYear);
//纵向排列年 //纵向排列年
@ -125,7 +125,7 @@ BI.extend(BI.YearCalendar, {
//获取显示的第一年 //获取显示的第一年
getStartYear: function (year) { getStartYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL; return year - ((year - cur + 3) % BI.YearCalendar.INTERVAL + 12) % BI.YearCalendar.INTERVAL;
}, },
@ -134,7 +134,7 @@ BI.extend(BI.YearCalendar, {
}, },
getPageByYear: function (year) { getPageByYear: function (year) {
var cur = new Date().getFullYear(); var cur = Date.getDate().getFullYear();
year = BI.YearCalendar.getStartYear(year); year = BI.YearCalendar.getStartYear(year);
return (year - cur + 3) / BI.YearCalendar.INTERVAL; return (year - cur + 3) / BI.YearCalendar.INTERVAL;
} }

4
src/core/base.js

@ -545,7 +545,7 @@ if (!window.BI) {
// Date // Date
if (type === '[object Date]') { if (type === '[object Date]') {
return new Date(obj.getTime()); return Date.getDate(obj.getTime());
} }
var i, clone, key; var i, clone, key;
@ -775,7 +775,7 @@ if (!window.BI) {
if (Date.now) { if (Date.now) {
return Date.now(); return Date.now();
} else { } else {
return new Date().getTime(); return Date.getDate().getTime();
} }
} }
} }

73
src/core/proto/date.js

@ -94,21 +94,22 @@ Date.prototype.getMonthDays = function (month) {
* @returns {Date} * @returns {Date}
*/ */
Date.prototype.getLastDateOfMonth = function () { Date.prototype.getLastDateOfMonth = function () {
return new Date(this.getFullYear(), this.getMonth(), this.getMonthDays()); return Date.getDate(this.getFullYear(), this.getMonth(), this.getMonthDays());
}; };
/** Returns the number of day in the year. */ /** Returns the number of day in the year. */
Date.prototype.getDayOfYear = function () { Date.prototype.getDayOfYear = function () {
var now = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var now = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var then = new Date(this.getFullYear(), 0, 0, 0, 0, 0); var then = Date.getDate(this.getFullYear(), 0, 0, 0, 0, 0);
var time = now - then; var time = now - then;
return Math.floor(time / Date.DAY); return Math.floor(time / Date.DAY);
}; };
/** Returns the number of the week in year, as defined in ISO 8601. */ /** Returns the number of the week in year, as defined in ISO 8601. */
Date.prototype.getWeekNumber = function () { Date.prototype.getWeekNumber = function () {
var d = new Date(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0); var d = Date.getDate(this.getFullYear(), this.getMonth(), this.getDate(), 0, 0, 0);
var week = d.getDay(); //周一是一周第一天
var week = d.getDay() === 0 ? 6 : d.getDay();
if (this.getMonth() === 0 && this.getDate() <= week) { if (this.getMonth() === 0 && this.getDate() <= week) {
return 1; return 1;
} }
@ -117,25 +118,29 @@ Date.prototype.getWeekNumber = function () {
d.setMonth(0); d.setMonth(0);
d.setDate(1); d.setDate(1);
var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1; var offset = Math.floor((ms - d.valueOf()) / (7 * 864e5)) + 1;
if (d.getDay() > 0) { if (d.getDay() !== 1) {
offset++; offset++;
} }
return offset; return offset;
}; };
Date.prototype.getQuarter = function () {
return Math.floor(this.getMonth() / 3) + 1;
};
//离当前时间多少天的时间 //离当前时间多少天的时间
Date.prototype.getOffsetDate = function (offset) { Date.prototype.getOffsetDate = function (offset) {
return new Date(this.getTime() + offset * 864e5); return Date.getDate(this.getTime() + offset * 864e5);
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -159,32 +164,32 @@ Date.prototype.getQuarterStartMonth = function () {
}; };
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
Date.prototype.getAfterMulQuarter = function (n) { Date.prototype.getAfterMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n * 3); dt.setMonth(dt.getMonth() + n * 3);
return dt; return dt;
}; };
//获得n个季度前的日期 //获得n个季度前的日期
Date.prototype.getBeforeMulQuarter = function (n) { Date.prototype.getBeforeMulQuarter = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n * 3); dt.setMonth(dt.getMonth() - n * 3);
return dt; return dt;
}; };
@ -209,9 +214,9 @@ Date.prototype.getQuarterStartMonth = function () {
//指定日期n个月之前或之后的日期 //指定日期n个月之前或之后的日期
Date.prototype.getOffsetMonth = function (n) { Date.prototype.getOffsetMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var day = dt.getDate(); var day = dt.getDate();
var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); var monthDay = Date.getDate(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays();
if (day > monthDay) { if (day > monthDay) {
day = monthDay; day = monthDay;
} }
@ -234,31 +239,31 @@ Date.prototype.getWeekEndDate = function () {
//获得本季度的起始日期 //获得本季度的起始日期
Date.prototype.getQuarterStartDate = function () { Date.prototype.getQuarterStartDate = function () {
return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); return Date.getDate(this.getFullYear(), this.getQuarterStartMonth(), 1);
}; };
//得到本季度的结束日期 //得到本季度的结束日期
Date.prototype.getQuarterEndDate = function () { Date.prototype.getQuarterEndDate = function () {
var quarterEndMonth = this.getQuarterStartMonth() + 2; var quarterEndMonth = this.getQuarterStartMonth() + 2;
return new Date(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth)); return Date.getDate(this.getFullYear(), quarterEndMonth, this.getMonthDays(quarterEndMonth));
}; };
Date.prototype.getAfterMultiMonth = function (n) { Date.prototype.getAfterMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() + n | 0); dt.setMonth(dt.getMonth() + n | 0);
return dt; return dt;
}; };
Date.prototype.getBeforeMultiMonth = function (n) { Date.prototype.getBeforeMultiMonth = function (n) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
dt.setMonth(dt.getMonth() - n | 0); dt.setMonth(dt.getMonth() - n | 0);
return dt; return dt;
}; };
//获得当前时区对应指定时区的时间 //获得当前时区对应指定时区的时间
Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) { Date.prototype.getTimeZoneTimeByTimezoneOffset = function (offset) {
var dt = new Date(this.getTime()); var dt = Date.getDate(this.getTime());
var localTime = dt.getTime(); var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数 var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区 var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + offset); return Date.getDate(utc + offset);
}; };
/** Checks date and time equality */ /** Checks date and time equality */
@ -273,7 +278,7 @@ Date.prototype.equalsTo = function (date) {
/** Set only the year, month, date parts (keep existing time) */ /** Set only the year, month, date parts (keep existing time) */
Date.prototype.setDateOnly = function (date) { Date.prototype.setDateOnly = function (date) {
var tmp = new Date(date); var tmp = Date.getDate(date);
this.setDate(1); this.setDate(1);
this.setFullYear(tmp.getFullYear()); this.setFullYear(tmp.getFullYear());
this.setMonth(tmp.getMonth()); this.setMonth(tmp.getMonth());
@ -285,6 +290,7 @@ Date.prototype.print = function (str) {
var d = this.getDate(); var d = this.getDate();
var y = this.getFullYear(); var y = this.getFullYear();
var wn = this.getWeekNumber(); var wn = this.getWeekNumber();
var qr = this.getQuarter();
var w = this.getDay(); var w = this.getDay();
var s = {}; var s = {};
var hr = this.getHours(); var hr = this.getHours();
@ -331,6 +337,7 @@ Date.prototype.print = function (str) {
s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99) s["%y"] = ('' + y).substr(2, 2); // year without the century (range 00 to 99)
s["%Y"] = y; // year with the century s["%Y"] = y; // year with the century
s["%%"] = "%"; // a literal '%' character s["%%"] = "%"; // a literal '%' character
s["%Q"] = qr;
var re = /%./g; var re = /%./g;
if (!BI.isKhtml()) { if (!BI.isKhtml()) {
@ -419,7 +426,7 @@ Date.checkLegal = function (str) {
}; };
Date.parseDateTime = function (str, fmt) { Date.parseDateTime = function (str, fmt) {
var today = new Date(); var today = Date.getDate();
var y = 0; var y = 0;
var m = 0; var m = 0;
var d = 1; var d = 1;
@ -512,7 +519,7 @@ Date.parseDateTime = function (str, fmt) {
sec = today.getSeconds(); sec = today.getSeconds();
} }
if (y != 0) { if (y != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
y = 0; y = 0;
m = -1; m = -1;
@ -545,7 +552,19 @@ Date.parseDateTime = function (str, fmt) {
y = today.getFullYear(); y = today.getFullYear();
} }
if (m != -1 && d != 0) { if (m != -1 && d != 0) {
return new Date(y, m, d, hr, min, sec); return Date.getDate(y, m, d, hr, min, sec);
} }
return today; return today;
}; };
Date.getDate = function () {
var dt = new (Function.prototype.bind.apply(Date, BI.concat([null], [].slice.apply(arguments))))();
if (arguments.length > 0 || BI.isNull(Date.timeZone)) {
return dt;
} else {
var localTime = dt.getTime();
var localOffset = dt.getTimezoneOffset() * 60000; //获得当地时间偏移的毫秒数
var utc = localTime + localOffset; //utc即GMT时间标准时区
return new Date(utc + Date.timeZone);//+ Pool.timeZone.offset);
}
};

4
src/widget/date/calendar/picker.date.js

@ -17,8 +17,8 @@ BI.DatePicker = BI.inherit(BI.Widget, {
_init: function () { _init: function () {
BI.DatePicker.superclass._init.apply(this, arguments); BI.DatePicker.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this._year = new Date().getFullYear(); this._year = Date.getDate().getFullYear();
this._month = new Date().getMonth(); this._month = Date.getDate().getMonth();
this.left = BI.createWidget({ this.left = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
cls: "pre-page-h-font", cls: "pre-page-h-font",

2
src/widget/date/calendar/popup.calendar.date.js

@ -34,7 +34,7 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, {
BI.DateCalendarPopup.superclass._init.apply(this, arguments); BI.DateCalendarPopup.superclass._init.apply(this, arguments);
var self = this, var self = this,
o = this.options; o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
this._day = this.today.getDate(); this._day = this.today.getDate();

28
src/widget/date/trigger.date.js

@ -132,7 +132,7 @@ BI.DateTrigger = BI.inherit(BI.Trigger, {
setValue: function (v) { setValue: function (v) {
var type, value, self = this; var type, value, self = this;
var date = new Date(); var date = Date.getDate();
this.store_value = v; this.store_value = v;
if (BI.isNotNull(v)) { if (BI.isNotNull(v)) {
type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value; type = v.type || BI.DateTrigger.MULTI_DATE_CALENDAR; value = v.value;
@ -149,62 +149,62 @@ BI.DateTrigger = BI.inherit(BI.Trigger, {
switch (type) { switch (type) {
case BI.DateTrigger.MULTI_DATE_YEAR_PREV: case BI.DateTrigger.MULTI_DATE_YEAR_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_PREV];
date = new Date((date.getFullYear() - 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() - 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_AFTER: case BI.DateTrigger.MULTI_DATE_YEAR_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_AFTER];
date = new Date((date.getFullYear() + 1 * value), date.getMonth(), date.getDate()); date = Date.getDate((date.getFullYear() + 1 * value), date.getMonth(), date.getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN: case BI.DateTrigger.MULTI_DATE_YEAR_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_BEGIN];
date = new Date(date.getFullYear(), 0, 1); date = Date.getDate(date.getFullYear(), 0, 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_YEAR_END: case BI.DateTrigger.MULTI_DATE_YEAR_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_YEAR_END];
date = new Date(date.getFullYear(), 11, 31); date = Date.getDate(date.getFullYear(), 11, 31);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_PREV: case BI.DateTrigger.MULTI_DATE_QUARTER_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_PREV];
date = new Date().getBeforeMulQuarter(value); date = Date.getDate().getBeforeMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER: case BI.DateTrigger.MULTI_DATE_QUARTER_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_AFTER];
date = new Date().getAfterMulQuarter(value); date = Date.getDate().getAfterMulQuarter(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN: case BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_BEGIN];
date = new Date().getQuarterStartDate(); date = Date.getDate().getQuarterStartDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_QUARTER_END: case BI.DateTrigger.MULTI_DATE_QUARTER_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_QUARTER_END];
date = new Date().getQuarterEndDate(); date = Date.getDate().getQuarterEndDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_PREV: case BI.DateTrigger.MULTI_DATE_MONTH_PREV:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_PREV];
date = new Date().getBeforeMultiMonth(value); date = Date.getDate().getBeforeMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_AFTER: case BI.DateTrigger.MULTI_DATE_MONTH_AFTER:
var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER]; var text = value + BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_AFTER];
date = new Date().getAfterMultiMonth(value); date = Date.getDate().getAfterMultiMonth(value);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN: case BI.DateTrigger.MULTI_DATE_MONTH_BEGIN:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_BEGIN];
date = new Date(date.getFullYear(), date.getMonth(), 1); date = Date.getDate(date.getFullYear(), date.getMonth(), 1);
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_MONTH_END: case BI.DateTrigger.MULTI_DATE_MONTH_END:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_MONTH_END];
date = new Date(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate()); date = Date.getDate(date.getFullYear(), date.getMonth(), (date.getLastDateOfMonth()).getDate());
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
case BI.DateTrigger.MULTI_DATE_WEEK_PREV: case BI.DateTrigger.MULTI_DATE_WEEK_PREV:
@ -229,7 +229,7 @@ BI.DateTrigger = BI.inherit(BI.Trigger, {
break; break;
case BI.DateTrigger.MULTI_DATE_DAY_TODAY: case BI.DateTrigger.MULTI_DATE_DAY_TODAY:
var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY]; var text = BI.DateTrigger.MULTI_DATE_SEGMENT_NUM[BI.DateTrigger.MULTI_DATE_DAY_TODAY];
date = new Date(); date = Date.getDate();
_setInnerValue(date, text); _setInnerValue(date, text);
break; break;
default: default:

4
src/widget/datepane/datepane.js

@ -15,7 +15,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
BI.DatePaneWidget.superclass._init.apply(this, arguments); BI.DatePaneWidget.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.today = new Date(); this.today = Date.getDate();
this._year = this.today.getFullYear(); this._year = this.today.getFullYear();
this._month = this.today.getMonth(); this._month = this.today.getMonth();
@ -79,7 +79,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, {
}, },
_getNewCurrentDate: function () { _getNewCurrentDate: function () {
var today = new Date(); var today = Date.getDate();
return { return {
year: today.getFullYear(), year: today.getFullYear(),
month: today.getMonth() month: today.getMonth()

2
src/widget/datetime/datetime.combo.js

@ -20,7 +20,7 @@ BI.DateTimeCombo = BI.inherit(BI.Single, {
_init: function () { _init: function () {
BI.DateTimeCombo.superclass._init.apply(this, arguments); BI.DateTimeCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
var date = new Date(); var date = Date.getDate();
this.storeValue = { this.storeValue = {
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),

4
src/widget/datetime/datetime.popup.js

@ -106,7 +106,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
}] }]
}); });
var date = new Date(); var date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),
@ -138,7 +138,7 @@ BI.DateTimePopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var value = v, date; var value = v, date;
if (BI.isNull(value)) { if (BI.isNull(value)) {
date = new Date(); date = Date.getDate();
this.dateCombo.setValue({ this.dateCombo.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),

4
src/widget/datetime/datetime.trigger.js

@ -46,10 +46,10 @@ BI.DateTimeTrigger = BI.inherit(BI.Trigger, {
var self = this; var self = this;
var value = v, dateStr; var value = v, dateStr;
if(BI.isNull(value)){ if(BI.isNull(value)){
value = new Date(); value = Date.getDate();
dateStr = value.print("%Y-%X-%d %H:%M:%S"); dateStr = value.print("%Y-%X-%d %H:%M:%S");
} else { } else {
var date = new Date(value.year,value.month,value.day,value.hour,value.minute,value.second); var date = Date.getDate(value.year,value.month,value.day,value.hour,value.minute,value.second);
dateStr = date.print("%Y-%X-%d %H:%M:%S"); dateStr = date.print("%Y-%X-%d %H:%M:%S");
} }

34
src/widget/multidate/abstract.multidate.datepane.js

@ -112,39 +112,39 @@ BI.MultiDateCard = BI.inherit(BI.Widget, {
var type = valueObject.type, value = valueObject.value; var type = valueObject.type, value = valueObject.value;
switch (type) { switch (type) {
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_PREV:
return new Date().getOffsetDate(-1 * value); return Date.getDate().getOffsetDate(-1 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_AFTER:
return new Date().getOffsetDate(value); return Date.getDate().getOffsetDate(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_DAY_TODAY:
return new Date(); return Date.getDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_PREV:
return new Date().getBeforeMultiMonth(value); return Date.getDate().getBeforeMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_AFTER:
return new Date().getAfterMultiMonth(value); return Date.getDate().getAfterMultiMonth(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_BEGIN:
return new Date(new Date().getFullYear(), new Date().getMonth(), 1); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_MONTH_END:
return new Date(new Date().getFullYear(), new Date().getMonth(), (new Date().getLastDateOfMonth()).getDate()); return Date.getDate(Date.getDate().getFullYear(), Date.getDate().getMonth(), (Date.getDate().getLastDateOfMonth()).getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_PREV:
return new Date().getBeforeMulQuarter(value); return Date.getDate().getBeforeMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_AFTER:
return new Date().getAfterMulQuarter(value); return Date.getDate().getAfterMulQuarter(value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_BEGIN:
return new Date().getQuarterStartDate(); return Date.getDate().getQuarterStartDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_QUARTER_END:
return new Date().getQuarterEndDate(); return Date.getDate().getQuarterEndDate();
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_PREV:
return new Date().getOffsetDate(-7 * value); return Date.getDate().getOffsetDate(-7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_WEEK_AFTER:
return new Date().getOffsetDate(7 * value); return Date.getDate().getOffsetDate(7 * value);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_PREV:
return new Date((new Date().getFullYear() - 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() - 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_AFTER:
return new Date((new Date().getFullYear() + 1 * value), new Date().getMonth(), new Date().getDate()); return Date.getDate((Date.getDate().getFullYear() + 1 * value), Date.getDate().getMonth(), Date.getDate().getDate());
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_BEGIN:
return new Date(new Date().getFullYear(), 0, 1); return Date.getDate(Date.getDate().getFullYear(), 0, 1);
case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END: case BI.MultiDateCombo.DATE_TYPE.MULTI_DATE_YEAR_END:
return new Date(new Date().getFullYear(), 11, 31); return Date.getDate(Date.getDate().getFullYear(), 11, 31);
} }
} }
}); });

4
src/widget/multidate/multidate.combo.js

@ -22,7 +22,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
BI.MultiDateCombo.superclass._init.apply(this, arguments); BI.MultiDateCombo.superclass._init.apply(this, arguments);
var self = this, opts = this.options; var self = this, opts = this.options;
this.storeTriggerValue = ""; this.storeTriggerValue = "";
var date = new Date(); var date = Date.getDate();
this.storeValue = null; this.storeValue = null;
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: 'bi.date_trigger', type: 'bi.date_trigger',
@ -89,7 +89,7 @@ BI.MultiDateCombo = BI.inherit(BI.Single, {
self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM); self.fireEvent(BI.MultiDateCombo.EVENT_CONFIRM);
}); });
this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () { this.popup.on(BI.MultiDatePopup.BUTTON_lABEL_EVENT_CHANGE, function () {
var date = new Date(); var date = Date.getDate();
self.setValue({ self.setValue({
year: date.getFullYear(), year: date.getFullYear(),
month: date.getMonth(), month: date.getMonth(),

2
src/widget/multidate/multidate.popup.js

@ -275,7 +275,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, {
break; break;
default: default:
if (this._checkValueValid(value)) { if (this._checkValueValid(value)) {
var date = new Date(); var date = Date.getDate();
this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD); this.dateTab.setSelect(BI.MultiDateCombo.MULTI_DATE_YMD_CARD);
this.ymd.setValue({ this.ymd.setValue({
year: date.getFullYear(), year: date.getFullYear(),

4
src/widget/year/popup.year.js

@ -37,7 +37,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
BI.YearPopup.superclass._init.apply(this, arguments); BI.YearPopup.superclass._init.apply(this, arguments);
var self = this; var self = this;
this.selectedYear = this._year = new Date().getFullYear(); this.selectedYear = this._year = Date.getDate().getFullYear();
var backBtn = BI.createWidget({ var backBtn = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
@ -91,7 +91,7 @@ BI.YearPopup = BI.inherit(BI.Widget, {
setValue: function (v) { setValue: function (v) {
var o = this.options; var o = this.options;
if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) { if (Date.checkVoid(v, 1, 1, o.min, o.max)[0]) {
v = new Date().getFullYear(); v = Date.getDate().getFullYear();
this.selectedYear = ""; this.selectedYear = "";
this.navigation.setSelect(BI.YearCalendar.getPageByYear(v)); this.navigation.setSelect(BI.YearCalendar.getPageByYear(v));
this.navigation.setValue(""); this.navigation.setValue("");

Loading…
Cancel
Save