X-Git-Url: http://git.ithinksw.org/extjs.git/blobdiff_plain/c930e9176a5a85509c5b0230e2bff5c22a591432..92c2b89db26be16707f4a805d3303ab2531006e1:/docs/source/Date.html?ds=inline diff --git a/docs/source/Date.html b/docs/source/Date.html index cc9eaddc..527100e5 100644 --- a/docs/source/Date.html +++ b/docs/source/Date.html @@ -1,5 +1,6 @@ + The source code @@ -615,15 +616,15 @@ dt = Date.parseDate("2006-02-29 03:20:01", "Y-m-d H:i:s", true); // returns null "dt = (new Date()).clearTime();", // date calculations (note: these calculations create a dependency on Ext.num()) - "y = y >= 0? y : Ext.num(def.y, dt.getFullYear());", - "m = m >= 0? m : Ext.num(def.m - 1, dt.getMonth());", - "d = d >= 0? d : Ext.num(def.d, dt.getDate());", + "y = Ext.num(y, Ext.num(def.y, dt.getFullYear()));", + "m = Ext.num(m, Ext.num(def.m - 1, dt.getMonth()));", + "d = Ext.num(d, Ext.num(def.d, dt.getDate()));", // time calculations (note: these calculations create a dependency on Ext.num()) - "h = h || Ext.num(def.h, dt.getHours());", - "i = i || Ext.num(def.i, dt.getMinutes());", - "s = s || Ext.num(def.s, dt.getSeconds());", - "ms = ms || Ext.num(def.ms, dt.getMilliseconds());", + "h = Ext.num(h, Ext.num(def.h, dt.getHours()));", + "i = Ext.num(i, Ext.num(def.i, dt.getMinutes()));", + "s = Ext.num(s, Ext.num(def.s, dt.getSeconds()));", + "ms = Ext.num(ms, Ext.num(def.ms, dt.getMilliseconds()));", "if(z >= 0 && y >= 0){", // both the year and zero-based day of year are defined and >= 0. @@ -795,15 +796,15 @@ dt = Date.parseDate("2006-02-29 03:20:01", "Y-m-d H:i:s", true); // returns null a: { g:1, c:"if (results[{0}] == 'am') {\n" - + "if (h == 12) { h = 0; }\n" - + "} else { if (h < 12) { h += 12; }}", + + "if (!h || h == 12) { h = 0; }\n" + + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}", s:"(am|pm)" }, A: { g:1, c:"if (results[{0}] == 'AM') {\n" - + "if (h == 12) { h = 0; }\n" - + "} else { if (h < 12) { h += 12; }}", + + "if (!h || h == 12) { h = 0; }\n" + + "} else { if (!h || h < 12) { h = (h || 0) + 12; }}", s:"(AM|PM)" }, g: function() { @@ -979,12 +980,12 @@ Ext.apply(Date.prototype, { * @return {Number} 0 to 364 (365 in leap years). */ getDayOfYear: function() { - var i = 0, - num = 0, + var num = 0, d = this.clone(), - m = this.getMonth(); + m = this.getMonth(), + i; - for (i = 0, d.setMonth(0); i < m; d.setMonth(++i)) { + for (i = 0, d.setDate(1), d.setMonth(0); i < m; d.setMonth(++i)) { num += d.getDaysInMonth(); } return num + this.getDate() - 1;