From 79cf858565f2b256d816b50edb025ff71589dcc0 Mon Sep 17 00:00:00 2001 From: Luke Smith Date: Fri, 2 Dec 2011 09:43:28 -0800 Subject: [PATCH] Build arraylist, calendar(-base), datatype --- build/arraylist/arraylist-debug.js | 4 +- build/arraylist/arraylist-min.js | 2 +- build/arraylist/arraylist.js | 4 +- build/calendar-base/calendar-base-debug.js | 2 +- build/calendar-base/calendar-base-min.js | 2 +- build/calendar-base/calendar-base.js | 2 +- build/calendar-base/lang/calendar-base_ja.js | 2 +- build/calendar/calendar-debug.js | 2 +- build/calendar/calendar-min.js | 2 +- build/calendar/calendar.js | 2 +- build/calendar/lang/calendar_ja.js | 2 +- build/console/lang/console_ja.js | 2 +- .../datatype-date-format-debug.js | 1 + .../datatype-date-format.js | 1 + .../lang/datatype-date-format_ja-JP.js | 2 +- .../lang/datatype-date-format_ja.js | 2 +- .../datatype-date-math-debug.js | 70 +++++++++++++++++-- .../datatype-date-math/datatype-date-math.js | 70 +++++++++++++++++-- 18 files changed, 146 insertions(+), 28 deletions(-) diff --git a/build/arraylist/arraylist-debug.js b/build/arraylist/arraylist-debug.js index 4333a8480ad..2e862651169 100644 --- a/build/arraylist/arraylist-debug.js +++ b/build/arraylist/arraylist-debug.js @@ -149,7 +149,9 @@ ArrayListProto = { */ ArrayListProto._item = ArrayListProto.item; -ArrayList.prototype = ArrayListProto; +// Mixed onto existing proto to preserve constructor NOT being an own property. +// This has bitten me when composing classes by enumerating, copying prototypes. +Y.mix(ArrayList.prototype, ArrayListProto); Y.mix( ArrayList, { diff --git a/build/arraylist/arraylist-min.js b/build/arraylist/arraylist-min.js index 75320ab8664..ae8d4016caa 100644 --- a/build/arraylist/arraylist-min.js +++ b/build/arraylist/arraylist-min.js @@ -1 +1 @@ -YUI.add("arraylist",function(e){var d=e.Array,c=d.each,a;function b(f){if(f!==undefined){this._items=e.Lang.isArray(f)?f:d(f);}else{this._items=this._items||[];}}a={item:function(f){return this._items[f];},each:function(g,f){c(this._items,function(j,h){j=this.item(h);g.call(f||j,j,h,this);},this);return this;},some:function(g,f){return d.some(this._items,function(j,h){j=this.item(h);return g.call(f||j,j,h,this);},this);},indexOf:function(f){return d.indexOf(this._items,f);},size:function(){return this._items.length;},isEmpty:function(){return !this.size();},toJSON:function(){return this._items;}};a._item=a.item;b.prototype=a;e.mix(b,{addMethod:function(f,g){g=d(g);c(g,function(h){f[h]=function(){var j=d(arguments,0,true),i=[];c(this._items,function(m,l){m=this._item(l);var k=m[h].apply(m,j);if(k!==undefined&&k!==m){i[l]=k;}},this);return i.length?i:this;};});}});e.ArrayList=b;},"@VERSION@",{requires:["yui-base"]}); \ No newline at end of file +YUI.add("arraylist",function(e){var d=e.Array,c=d.each,a;function b(f){if(f!==undefined){this._items=e.Lang.isArray(f)?f:d(f);}else{this._items=this._items||[];}}a={item:function(f){return this._items[f];},each:function(g,f){c(this._items,function(j,h){j=this.item(h);g.call(f||j,j,h,this);},this);return this;},some:function(g,f){return d.some(this._items,function(j,h){j=this.item(h);return g.call(f||j,j,h,this);},this);},indexOf:function(f){return d.indexOf(this._items,f);},size:function(){return this._items.length;},isEmpty:function(){return !this.size();},toJSON:function(){return this._items;}};a._item=a.item;e.mix(b.prototype,a);e.mix(b,{addMethod:function(f,g){g=d(g);c(g,function(h){f[h]=function(){var j=d(arguments,0,true),i=[];c(this._items,function(m,l){m=this._item(l);var k=m[h].apply(m,j);if(k!==undefined&&k!==m){i[l]=k;}},this);return i.length?i:this;};});}});e.ArrayList=b;},"@VERSION@",{requires:["yui-base"]}); \ No newline at end of file diff --git a/build/arraylist/arraylist.js b/build/arraylist/arraylist.js index 4333a8480ad..2e862651169 100644 --- a/build/arraylist/arraylist.js +++ b/build/arraylist/arraylist.js @@ -149,7 +149,9 @@ ArrayListProto = { */ ArrayListProto._item = ArrayListProto.item; -ArrayList.prototype = ArrayListProto; +// Mixed onto existing proto to preserve constructor NOT being an own property. +// This has bitten me when composing classes by enumerating, copying prototypes. +Y.mix(ArrayList.prototype, ArrayListProto); Y.mix( ArrayList, { diff --git a/build/calendar-base/calendar-base-debug.js b/build/calendar-base/calendar-base-debug.js index ee90970ccd6..7a30e5b91f3 100644 --- a/build/calendar-base/calendar-base-debug.js +++ b/build/calendar-base/calendar-base-debug.js @@ -1641,4 +1641,4 @@ Y.CalendarBase = Y.extend( CalendarBase, Y.Widget, { }); -}, '@VERSION@' ,{requires:['widget', 'substitute', 'datatype-date', 'datatype-date-math', 'cssgrids'], lang:['en', 'ja', 'ru']}); +}, '@VERSION@' ,{lang:['en', 'ja', 'ru'], requires:['widget', 'substitute', 'datatype-date', 'datatype-date-math', 'cssgrids']}); diff --git a/build/calendar-base/calendar-base-min.js b/build/calendar-base/calendar-base-min.js index 48fb6ec566e..5079e60c7d6 100644 --- a/build/calendar-base/calendar-base-min.js +++ b/build/calendar-base/calendar-base-min.js @@ -1,3 +1,3 @@ YUI.add("calendar-base",function(c){var D=c.ClassNameManager.getClassName,q="calendar",j=D(q,"grid"),d=D(q,"left-grid"),x=D(q,"right-grid"),z=D(q,"body"),p=D(q,"header"),m=D(q,"header-label"),r=D(q,"weekdayrow"),B=D(q,"weekday"),v=D(q,"column-hidden"),e=D(q,"day-selected"),g=D(q,"selection-disabled"),k=D(q,"row"),C=D(q,"day"),b=D(q,"prevmonth-day"),s=D(q,"nextmonth-day"),y=D(q,"anchor"),G=D(q,"pane"),i=c.Lang,t=c.Node,l=t.create,u=c.substitute,f=c.each,F=c.Array.hasValue,w=c.Array.indexOf,E=c.Object.hasKey,a=c.Object.setValue,h=c.Object.owns,o=c.Object.isEmpty,n=c.DataType.Date;function A(H){A.superclass.constructor.apply(this,arguments);}c.CalendarBase=c.extend(A,c.Widget,{_paneProperties:{},_paneNumber:1,_calendarId:null,_selectedDates:{},_rules:{},_filterFunction:null,_storedDateCells:{},initializer:function(){this._paneProperties={};this._calendarId=c.guid("calendar");this._selectedDates={};this._rules={};this.storedDateCells={};},renderUI:function(){var H=this.get("contentBox");H.appendChild(this._initCalendarHTML(this.get("date")));if(this.get("showPrevMonth")){this._afterShowPrevMonthChange();}if(this.get("showNextMonth")){this._afterShowNextMonthChange();}this._renderCustomRules();this._renderSelectedDates();},bindUI:function(){this.after("dateChange",this._afterDateChange);this.after("showPrevMonthChange",this._afterShowPrevMonthChange);this.after("showNextMonthChange",this._afterShowNextMonthChange);this.after("headerRendererChange",this._afterHeaderRendererChange);this.after("customRendererChange",this._afterCustomRendererChange);this._bindCalendarEvents();},syncUI:function(){if(this.get("showPrevMonth")){this._afterShowPrevMonthChange();}if(this.get("showNextMonth")){this._afterShowNextMonthChange();}},_getSelectedDatesList:function(){var H=[];f(this._selectedDates,function(I){f(I,function(J){f(J,function(K){H.push(K);},this);},this);},this);return H;},_getSelectedDatesInMonth:function(I){var H=I.getFullYear(),J=I.getMonth();if(E(this._selectedDates,H)&&E(this._selectedDates[H],J)){return c.Object.values(this._selectedDates[H][J]);}else{return[];}},_renderSelectedDate:function(H){if(this._isDateVisible(H)){this._dateToNode(H).addClass(e);}},_renderUnselectedDate:function(H){if(this._isDateVisible(H)){this._dateToNode(H).removeClass(e);}},_isDateVisible:function(H){var I=this.get("date"),J=n.addMonths(I,this._paneNumber-1),K=this._normalizeDate(H).getTime();if(I.getTime()<=K&&K<=J){return true;}else{return false;}},_isNumInList:function(I,L){if(L=="all"){return true;}else{var J=L.split(","),K;for(K in J){var H=J[K].split("-");if(H.length==2&&I>=parseInt(H[0],10)&&I<=parseInt(H[1],10)){return true;}else{if(H.length==1&&(parseInt(J[K],10)==I)){return true;}}}return false;}},_getRulesForDate:function(R){var N=R.getFullYear(),L=R.getMonth(),J=R.getDate(),M=R.getDay(),Q=this._rules,O=[],K,I,H,P;for(K in Q){if(this._isNumInList(N,K)){if(i.isString(Q[K])){O.push(Q[K]);}else{for(I in Q[K]){if(this._isNumInList(L,I)){if(i.isString(Q[K][I])){O.push(Q[K][I]);}else{for(H in Q[K][I]){if(this._isNumInList(J,H)){if(i.isString(Q[K][I][H])){O.push(Q[K][I][H]);}else{for(P in Q[K][I][H]){if(this._isNumInList(M,P)){if(i.isString(Q[K][I][H][P])){O.push(Q[K][I][H][P]);}}}}}}}}}}}}return O;},_matchesRule:function(H,I){return(w(this._getRulesForDate(H),I)>=0);},_canBeSelected:function(J){var H=this.get("enabledDatesRule"),I=this.get("disabledDatesRule");if(H){return this._matchesRule(J,H);}else{if(I){return !this._matchesRule(J,I);}else{return true;}}},selectDates:function(H){if(n.isValidDate(H)){this._addDateToSelection(H);}else{if(i.isArray(H)){this._addDatesToSelection(H);}}},deselectDates:function(H){if(H==null){this._clearSelection();}else{if(n.isValidDate(H)){this._removeDateFromSelection(H);}else{if(i.isArray(H)){this._removeDatesFromSelection(H);}}}},_addDateToSelection:function(K,I){if(this._canBeSelected(K)){var J=K.getFullYear(),L=K.getMonth(),H=K.getDate();if(E(this._selectedDates,J)){if(E(this._selectedDates[J],L)){this._selectedDates[J][L][H]=K;}else{this._selectedDates[J][L]={};this._selectedDates[J][L][H]=K;}}else{this._selectedDates[J]={};this._selectedDates[J][L]={};this._selectedDates[J][L][H]=K;}this._selectedDates=a(this._selectedDates,[J,L,H],K);this._renderSelectedDate(K);if(I==null){this._fireSelectionChange();}}},_addDatesToSelection:function(H){f(H,this._addDateToSelection,this);this._fireSelectionChange();},_addDateRangeToSelection:function(H,M){var I=(M.getTimezoneOffset()-H.getTimezoneOffset())*60000,K=H.getTime(),J=M.getTime();if(K>J){var O=K;K=J;J=O+I;}else{J=J-I;}for(var L=K;L<=J;L+=86400000){var N=new Date(L);N.setHours(12);this._addDateToSelection(N,L);}this._fireSelectionChange();},_removeDateFromSelection:function(K,I){var J=K.getFullYear(),L=K.getMonth(),H=K.getDate();if(E(this._selectedDates,J)&&E(this._selectedDates[J],L)&&E(this._selectedDates[J][L],H)){delete this._selectedDates[J][L][H];this._renderUnselectedDate(K);if(I==null){this._fireSelectionChange();}}},_removeDatesFromSelection:function(H){f(H,this._removeDateDromSelection);this._fireSelectionChange();},_removeDateRangeFromSelection:function(H,L){var J=H.getTime(),I=L.getTime();for(var K=J;K<=I;K+=86400000){this._removeDateFromSelection(new Date(K),K);}this._fireSelectionChange();},_clearSelection:function(H){this._selectedDates={};this.get("contentBox").all("."+e).removeClass(e);if(!H){this._fireSelectionChange();}},_fireSelectionChange:function(){this.fire("selectionChange",{newSelection:this._getSelectedDatesList()});},_restoreModifiedCells:function(){var H=this.get("contentBox"),I;for(I in this._storedDateCells){H.one("#"+I).replace(this._storedDateCells[I]);delete this._storedDateCells[I];}},_renderCustomRules:function(){this.get("contentBox").all("."+C+",."+s).removeClass(g);if(!o(this._rules)){var K=this.get("enabledDatesRule"),J=this.get("disabledDatesRule");for(var I=0;I0){var N=this._dateToNode(M);if((K&&!(w(O,K)>=0))||(J&&(w(O,J)>=0))){N.addClass(g);}if(i.isFunction(this._filterFunction)){this._storedDateCells[N.get("id")]=N.cloneNode(true);this._filterFunction(M,N,O);}}},this);}}},_renderSelectedDates:function(){this.get("contentBox").all("."+e).removeClass(e);for(var I=0;I=6){J=12;}else{J=5;}break;case (1):J=6;break;case (2):if(M>0){J=7;}else{J=0;}break;case (3):if(M>1){J=8;}else{J=1;}break;case (4):if(M>2){J=9;}else{J=2;}break;case (5):if(M>3){J=10;}else{J=3;}break;case (6):if(M>4){J=11;}else{J=4;}break;}return(this.get("contentBox").one("#"+this._calendarId+"_pane_"+L+"_"+J+"_"+H));},_nodeToDate:function(N){var I=N.get("id").split("_").reverse(),K=parseInt(I[2],10),H=parseInt(I[0],10);var M=n.addMonths(this.get("date"),K),J=M.getFullYear(),L=M.getMonth();return new Date(J,L,H,12,0,0,0);},_bindCalendarEvents:function(){},_normalizeDate:function(H){return new Date(H.getFullYear(),H.getMonth(),1,12,0,0,0);},_getCutoffColumn:function(I,J){var K=this._normalizeDate(I).getDay()-J;var H=6-(K+7)%7;return H;},_turnPrevMonthOn:function(L){var K=L.get("id"),I=this._paneProperties[K].paneDate,J=n.daysInMonth(n.addMonths(I,-1));if(!this._paneProperties[K].hasOwnProperty("daysInPrevMonth")){this._paneProperties[K].daysInPrevMonth=0;}if(J!=this._paneProperties[K].daysInPrevMonth){this._paneProperties[K].daysInPrevMonth=J;for(var H=5;H>=0;H--){L.one("#"+K+"_"+H+"_"+(H-5)).setContent(J--);}}},_turnPrevMonthOff:function(J){var I=J.get("id");this._paneProperties[I].daysInPrevMonth=0;for(var H=5;H>=0;H--){J.one("#"+I+"_"+H+"_"+(H-5)).setContent(" ");}},_cleanUpNextMonthCells:function(I){var H=I.get("id");I.one("#"+H+"_6_29").removeClass(s);I.one("#"+H+"_7_30").removeClass(s);I.one("#"+H+"_8_31").removeClass(s);I.one("#"+H+"_0_30").removeClass(s);I.one("#"+H+"_1_31").removeClass(s);},_turnNextMonthOn:function(N){var I=1,M=N.get("id"),J=this._paneProperties[M].daysInMonth,L=this._paneProperties[M].cutoffCol;for(var H=J-22;HI){V=s;}}if(L<1||L>I){L=" ";}var O=(M>=S&&M<(S+7))?"":v;R[X]+=u(A.CALDAY_TEMPLATE,{day_content:L,calendar_col_class:"calendar_col"+M,calendar_col_visibility_class:O,calendar_day_class:V,calendar_day_id:Q});}}P["body_template"]="";f(R,function(Y){P["body_template"]+=u(A.CALDAY_ROW_TEMPLATE,{calday_row:Y});});P["calendar_pane_id"]=N;var J=u(u(A.CALENDAR_GRID_TEMPLATE,P),A.CALENDAR_STRINGS);this._paneProperties[N]={cutoffCol:S,daysInMonth:I,paneDate:K};return J;},_rerenderCalendarPane:function(O,J){var H=this.get("strings.first_weekday")||0,N=this._getCutoffColumn(O,H),I=n.daysInMonth(O),L=J.get("id");J.setStyle("visibility","hidden");for(var K=0;K<=12;K++){var M=J.all("."+"calendar_col"+K);M.removeClass(v);if(K=(N+7)){M.addClass(v);}else{switch(K){case 0:var P=J.one("#"+L+"_0_30");if(I>=30){P.setContent("30");P.removeClass(s).addClass(C);}else{P.setContent(" ");P.addClass(s).addClass(C);}break;case 1:var P=J.one("#"+L+"_1_31");if(I>=31){P.setContent("31");P.removeClass(s).addClass(C);}else{P.setContent(" ");P.removeClass(C).addClass(s);}break;case 6:var P=J.one("#"+L+"_6_29");if(I>=29){P.setContent("29");P.removeClass(s).addClass(C);}else{P.setContent(" ");P.removeClass(C).addClass(s);}break;case 7:var P=J.one("#"+L+"_7_30");if(I>=30){P.setContent("30");P.removeClass(s).addClass(C);}else{P.setContent(" ");P.removeClass(C).addClass(s);}break;case 8:var P=J.one("#"+L+"_8_31");if(I>=31){P.setContent("31");P.removeClass(s).addClass(C); -}else{P.setContent(" ");P.removeClass(C).addClass(s);}break;}}}this._paneProperties[L].cutoffCol=N;this._paneProperties[L].daysInMonth=I;this._paneProperties[L].paneDate=O;J.setStyle("visibility","visible");},_updateCalendarHeader:function(J){var I="",H=this.get("headerRenderer");if(c.Lang.isString(H)){I=n.format(J,{format:H});}else{if(H instanceof Function){I=H.call(this,J);}}return I;},_initCalendarHeader:function(H){return u(u(A.HEADER_TEMPLATE,{calheader:this._updateCalendarHeader(H)}),A.CALENDAR_STRINGS);},_initCalendarHTML:function(K){var J={},H=0;J["header_template"]=this._initCalendarHeader(K);J["calendar_id"]=this._calendarId;J["body_template"]=u(u(A.CONTENT_TEMPLATE,J),A.CALENDAR_STRINGS);function L(){var M=this._initCalendarPane(n.addMonths(K,H),J["calendar_id"]+"_pane_"+H);H++;return M;}var I=J["body_template"].replace(/\{calendar_grid_template\}/g,c.bind(L,this));this._paneNumber=H;return I;}},{CALENDAR_STRINGS:{calendar_grid_class:j,calendar_body_class:z,calendar_hd_class:p,calendar_hd_label_class:m,calendar_weekdayrow_class:r,calendar_weekday_class:B,calendar_row_class:k,calendar_day_class:C,calendar_dayanchor_class:y,calendar_pane_class:G,calendar_right_grid_class:x,calendar_left_grid_class:d},CONTENT_TEMPLATE:'
'+"{header_template}"+'
'+"{calendar_grid_template}"+"
"+"
",ONE_PANE_TEMPLATE:'
'+"{header_template}"+'
'+"{calendar_grid_template}"+"
"+"
",TWO_PANE_TEMPLATE:'
'+"{header_template}"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+"
",THREE_PANE_TEMPLATE:'
'+"{header_template}"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+'
'+"{calendar_grid_template}"+"
"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+"
",CALENDAR_GRID_TEMPLATE:''+""+"{weekday_row_template}"+""+""+"{body_template}"+""+"
",HEADER_TEMPLATE:'
'+'
'+"

"+"{calheader}"+"

"+"
"+"
",WEEKDAY_ROW_TEMPLATE:''+"{weekday_row}"+"",CALDAY_ROW_TEMPLATE:''+"{calday_row}"+"",WEEKDAY_TEMPLATE:'{weekdayname}',CALDAY_TEMPLATE:''+"{day_content}"+"",NAME:"calendarBase",ATTRS:{date:{value:new Date(),setter:function(I){var H=this._normalizeDate(I);if(n.areEqual(H,this.get("date"))){return this.get("date");}}},showPrevMonth:{value:false},showNextMonth:{value:false},strings:{valueFn:function(){return c.Intl.get("calendar-base");}},headerRenderer:{value:"%B %Y"},enabledDatesRule:{value:null},disabledDatesRule:{value:null},selectedDates:{readOnly:true,getter:function(H){return(this._getSelectedDatesList());}},customRenderer:{value:{},setter:function(H){this._rules=H.rules;this._filterFunction=H.filterFunction;}}}});},"@VERSION@",{requires:["widget","substitute","datatype-date","datatype-date-math","cssgrids"],lang:["en","ja","ru"]}); \ No newline at end of file +}else{P.setContent(" ");P.removeClass(C).addClass(s);}break;}}}this._paneProperties[L].cutoffCol=N;this._paneProperties[L].daysInMonth=I;this._paneProperties[L].paneDate=O;J.setStyle("visibility","visible");},_updateCalendarHeader:function(J){var I="",H=this.get("headerRenderer");if(c.Lang.isString(H)){I=n.format(J,{format:H});}else{if(H instanceof Function){I=H.call(this,J);}}return I;},_initCalendarHeader:function(H){return u(u(A.HEADER_TEMPLATE,{calheader:this._updateCalendarHeader(H)}),A.CALENDAR_STRINGS);},_initCalendarHTML:function(K){var J={},H=0;J["header_template"]=this._initCalendarHeader(K);J["calendar_id"]=this._calendarId;J["body_template"]=u(u(A.CONTENT_TEMPLATE,J),A.CALENDAR_STRINGS);function L(){var M=this._initCalendarPane(n.addMonths(K,H),J["calendar_id"]+"_pane_"+H);H++;return M;}var I=J["body_template"].replace(/\{calendar_grid_template\}/g,c.bind(L,this));this._paneNumber=H;return I;}},{CALENDAR_STRINGS:{calendar_grid_class:j,calendar_body_class:z,calendar_hd_class:p,calendar_hd_label_class:m,calendar_weekdayrow_class:r,calendar_weekday_class:B,calendar_row_class:k,calendar_day_class:C,calendar_dayanchor_class:y,calendar_pane_class:G,calendar_right_grid_class:x,calendar_left_grid_class:d},CONTENT_TEMPLATE:'
'+"{header_template}"+'
'+"{calendar_grid_template}"+"
"+"
",ONE_PANE_TEMPLATE:'
'+"{header_template}"+'
'+"{calendar_grid_template}"+"
"+"
",TWO_PANE_TEMPLATE:'
'+"{header_template}"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+"
",THREE_PANE_TEMPLATE:'
'+"{header_template}"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+'
'+"{calendar_grid_template}"+"
"+'
'+'
'+"{calendar_grid_template}"+"
"+"
"+"
",CALENDAR_GRID_TEMPLATE:''+""+"{weekday_row_template}"+""+""+"{body_template}"+""+"
",HEADER_TEMPLATE:'
'+'
'+"

"+"{calheader}"+"

"+"
"+"
",WEEKDAY_ROW_TEMPLATE:''+"{weekday_row}"+"",CALDAY_ROW_TEMPLATE:''+"{calday_row}"+"",WEEKDAY_TEMPLATE:'{weekdayname}',CALDAY_TEMPLATE:''+"{day_content}"+"",NAME:"calendarBase",ATTRS:{date:{value:new Date(),setter:function(I){var H=this._normalizeDate(I);if(n.areEqual(H,this.get("date"))){return this.get("date");}}},showPrevMonth:{value:false},showNextMonth:{value:false},strings:{valueFn:function(){return c.Intl.get("calendar-base");}},headerRenderer:{value:"%B %Y"},enabledDatesRule:{value:null},disabledDatesRule:{value:null},selectedDates:{readOnly:true,getter:function(H){return(this._getSelectedDatesList());}},customRenderer:{value:{},setter:function(H){this._rules=H.rules;this._filterFunction=H.filterFunction;}}}});},"@VERSION@",{lang:["en","ja","ru"],requires:["widget","substitute","datatype-date","datatype-date-math","cssgrids"]}); \ No newline at end of file diff --git a/build/calendar-base/calendar-base.js b/build/calendar-base/calendar-base.js index ee90970ccd6..7a30e5b91f3 100644 --- a/build/calendar-base/calendar-base.js +++ b/build/calendar-base/calendar-base.js @@ -1641,4 +1641,4 @@ Y.CalendarBase = Y.extend( CalendarBase, Y.Widget, { }); -}, '@VERSION@' ,{requires:['widget', 'substitute', 'datatype-date', 'datatype-date-math', 'cssgrids'], lang:['en', 'ja', 'ru']}); +}, '@VERSION@' ,{lang:['en', 'ja', 'ru'], requires:['widget', 'substitute', 'datatype-date', 'datatype-date-math', 'cssgrids']}); diff --git a/build/calendar-base/lang/calendar-base_ja.js b/build/calendar-base/lang/calendar-base_ja.js index c3e8958d6a5..d17ce72fada 100644 --- a/build/calendar-base/lang/calendar-base_ja.js +++ b/build/calendar-base/lang/calendar-base_ja.js @@ -1 +1 @@ -YUI.add("lang/calendar-base_ja",function(a){a.Intl.add("calendar-base","ja",{weekdays:["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],short_weekdays:["日曜","月曜","火曜","水曜","木曜","金曜","土曜"],very_short_weekdays:["日","月","火","水","木","金","土"],first_weekday:0,weekends:[0,6]});},"@VERSION@"); \ No newline at end of file +YUI.add("lang/calendar-base_ja",function(a){a.Intl.add("calendar-base","ja",{weekdays:["\u65E5\u66DC\u65E5","\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5"],short_weekdays:["\u65E5\u66DC","\u6708\u66DC","\u706B\u66DC","\u6C34\u66DC","\u6728\u66DC","\u91D1\u66DC","\u571F\u66DC"],very_short_weekdays:["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],first_weekday:0,weekends:[0,6]});},"@VERSION@"); \ No newline at end of file diff --git a/build/calendar/calendar-debug.js b/build/calendar/calendar-debug.js index 688a2eecf56..e9beb6659b9 100644 --- a/build/calendar/calendar-debug.js +++ b/build/calendar/calendar-debug.js @@ -354,4 +354,4 @@ Y.Calendar = Y.extend(Calendar, Y.CalendarBase, { }); -}, '@VERSION@' ,{requires:['calendar-base', 'calendarnavigator'], lang:['en', 'ja', 'ru']}); +}, '@VERSION@' ,{lang:['en', 'ja', 'ru'], requires:['calendar-base', 'calendarnavigator']}); diff --git a/build/calendar/calendar-min.js b/build/calendar/calendar-min.js index 9d5b7ecd21f..38f99cb32f9 100644 --- a/build/calendar/calendar-min.js +++ b/build/calendar/calendar-min.js @@ -1 +1 @@ -YUI.add("calendar",function(a){var e=a.ClassNameManager.getClassName,m="calendar",h=e(m,"header"),d=e(m,"day-selected"),b=e(m,"day"),l=e(m,"prevmonth-day"),j=e(m,"nextmonth-day"),k=a.DataType.Date,i=a.delegate,g=e(m,"pane"),f=a.UA.os;function c(n){c.superclass.constructor.apply(this,arguments);}a.Calendar=a.extend(c,a.CalendarBase,{_lastSelectedDate:null,initializer:function(){this.plug(a.Plugin.CalendarNavigator);},syncUI:function(){},_bindCalendarEvents:function(){var n=this.get("contentBox"),o=n.one("."+g);o.on("selectstart",function(p){p.preventDefault();});o.delegate("click",this._clickCalendar,"."+b,this);},_clickCalendar:function(q){var r=q.target,o=r.hasClass(b)&&!r.hasClass(l)&&!r.hasClass(j),n=r.hasClass(d);switch(this.get("selectionMode")){case ("single"):if(o){if(!n){this._clearSelection(true);this._addDateToSelection(this._nodeToDate(r));}}break;case ("multiple-sticky"):if(o){if(n){this._removeDateFromSelection(this._nodeToDate(r));}else{this._addDateToSelection(this._nodeToDate(r));}}break;case ("multiple"):if(!q.metaKey&&!q.ctrlKey&&!q.shiftKey){this._clearSelection(true);this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}else{if(((f=="macintosh"&&q.metaKey)||(f!="macintosh"&&q.ctrlKey))&&!q.shiftKey){if(n){this._removeDateFromSelection(this._nodeToDate(r));this._lastSelectedDate=null;}else{this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}}else{if(((f=="macintosh"&&q.metaKey)||(f!="macintosh"&&q.ctrlKey))&&q.shiftKey){if(this._lastSelectedDate!=null){var p=this._nodeToDate(r);this._addDateRangeToSelection(p,this._lastSelectedDate);this._lastSelectedDate=p;}else{this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}}else{if(q.shiftKey){if(this._lastSelectedDate!=null){var p=this._nodeToDate(r);this._clearSelection(true);this._addDateRangeToSelection(p,this._lastSelectedDate);this._lastSelectedDate=p;}else{this._clearSelection(true);this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}}}}}break;}if(o){this.fire("dateClick",{cell:r,date:this._nodeToDate(r)});}else{if(r.hasClass(l)){this.fire("prevMonthClick");}else{if(r.hasClass(j)){this.fire("nextMonthClick");}}}},subtractMonth:function(n){this.set("date",k.addMonths(this.get("date"),-1));n.halt();},subtractYear:function(n){this.set("date",k.addYears(this.get("date"),-1));n.halt();},addMonth:function(n){this.set("date",k.addMonths(this.get("date"),1));n.halt();},addYear:function(n){this.set("date",k.addYears(this.get("date"),1));n.halt();}},{NAME:"Calendar",ATTRS:{selectionMode:{value:"single"},date:{value:new Date(),setter:function(s){var o=this._normalizeDate(s),p=k.addMonths(o,this._paneNumber-1),q=this.get("minimumDate"),r=this.get("maximumDate");if((q==null||k.isGreaterOrEqual(o,q))&&(r==null||k.isGreaterOrEqual(r,p))){return o;}else{if(q!=null&&k.isGreater(q,o)){return q;}else{if(r!=null&&k.isGreater(p,r)){var n=k.addMonths(r,-1*(this._paneNumber-1));return n;}}}}},minimumDate:{value:null,setter:function(p){if(p!=null){var o=this.get("date"),n=this._normalizeDate(p);if(o!=null&&!k.isGreaterOrEqual(o,n)){this.set("date",n);}return n;}else{return p;}}},maximumDate:{value:null,setter:function(p){if(p!=null){var n=this.get("date"),o=this._normalizeDate(p);if(n!=null&&!k.isGreaterOrEqual(p,k.addMonths(n,this._paneNumber-1))){this.set("date",k.addMonths(o,-1*(this._paneNumber-1)));}return o;}else{return p;}}}}});},"@VERSION@",{requires:["calendar-base","calendarnavigator"],lang:["en","ja","ru"]}); \ No newline at end of file +YUI.add("calendar",function(a){var e=a.ClassNameManager.getClassName,m="calendar",h=e(m,"header"),d=e(m,"day-selected"),b=e(m,"day"),l=e(m,"prevmonth-day"),j=e(m,"nextmonth-day"),k=a.DataType.Date,i=a.delegate,g=e(m,"pane"),f=a.UA.os;function c(n){c.superclass.constructor.apply(this,arguments);}a.Calendar=a.extend(c,a.CalendarBase,{_lastSelectedDate:null,initializer:function(){this.plug(a.Plugin.CalendarNavigator);},syncUI:function(){},_bindCalendarEvents:function(){var n=this.get("contentBox"),o=n.one("."+g);o.on("selectstart",function(p){p.preventDefault();});o.delegate("click",this._clickCalendar,"."+b,this);},_clickCalendar:function(q){var r=q.target,o=r.hasClass(b)&&!r.hasClass(l)&&!r.hasClass(j),n=r.hasClass(d);switch(this.get("selectionMode")){case ("single"):if(o){if(!n){this._clearSelection(true);this._addDateToSelection(this._nodeToDate(r));}}break;case ("multiple-sticky"):if(o){if(n){this._removeDateFromSelection(this._nodeToDate(r));}else{this._addDateToSelection(this._nodeToDate(r));}}break;case ("multiple"):if(!q.metaKey&&!q.ctrlKey&&!q.shiftKey){this._clearSelection(true);this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}else{if(((f=="macintosh"&&q.metaKey)||(f!="macintosh"&&q.ctrlKey))&&!q.shiftKey){if(n){this._removeDateFromSelection(this._nodeToDate(r));this._lastSelectedDate=null;}else{this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}}else{if(((f=="macintosh"&&q.metaKey)||(f!="macintosh"&&q.ctrlKey))&&q.shiftKey){if(this._lastSelectedDate!=null){var p=this._nodeToDate(r);this._addDateRangeToSelection(p,this._lastSelectedDate);this._lastSelectedDate=p;}else{this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}}else{if(q.shiftKey){if(this._lastSelectedDate!=null){var p=this._nodeToDate(r);this._clearSelection(true);this._addDateRangeToSelection(p,this._lastSelectedDate);this._lastSelectedDate=p;}else{this._clearSelection(true);this._lastSelectedDate=this._nodeToDate(r);this._addDateToSelection(this._lastSelectedDate);}}}}}break;}if(o){this.fire("dateClick",{cell:r,date:this._nodeToDate(r)});}else{if(r.hasClass(l)){this.fire("prevMonthClick");}else{if(r.hasClass(j)){this.fire("nextMonthClick");}}}},subtractMonth:function(n){this.set("date",k.addMonths(this.get("date"),-1));n.halt();},subtractYear:function(n){this.set("date",k.addYears(this.get("date"),-1));n.halt();},addMonth:function(n){this.set("date",k.addMonths(this.get("date"),1));n.halt();},addYear:function(n){this.set("date",k.addYears(this.get("date"),1));n.halt();}},{NAME:"Calendar",ATTRS:{selectionMode:{value:"single"},date:{value:new Date(),setter:function(s){var o=this._normalizeDate(s),p=k.addMonths(o,this._paneNumber-1),q=this.get("minimumDate"),r=this.get("maximumDate");if((q==null||k.isGreaterOrEqual(o,q))&&(r==null||k.isGreaterOrEqual(r,p))){return o;}else{if(q!=null&&k.isGreater(q,o)){return q;}else{if(r!=null&&k.isGreater(p,r)){var n=k.addMonths(r,-1*(this._paneNumber-1));return n;}}}}},minimumDate:{value:null,setter:function(p){if(p!=null){var o=this.get("date"),n=this._normalizeDate(p);if(o!=null&&!k.isGreaterOrEqual(o,n)){this.set("date",n);}return n;}else{return p;}}},maximumDate:{value:null,setter:function(p){if(p!=null){var n=this.get("date"),o=this._normalizeDate(p);if(n!=null&&!k.isGreaterOrEqual(p,k.addMonths(n,this._paneNumber-1))){this.set("date",k.addMonths(o,-1*(this._paneNumber-1)));}return o;}else{return p;}}}}});},"@VERSION@",{lang:["en","ja","ru"],requires:["calendar-base","calendarnavigator"]}); \ No newline at end of file diff --git a/build/calendar/calendar.js b/build/calendar/calendar.js index 688a2eecf56..e9beb6659b9 100644 --- a/build/calendar/calendar.js +++ b/build/calendar/calendar.js @@ -354,4 +354,4 @@ Y.Calendar = Y.extend(Calendar, Y.CalendarBase, { }); -}, '@VERSION@' ,{requires:['calendar-base', 'calendarnavigator'], lang:['en', 'ja', 'ru']}); +}, '@VERSION@' ,{lang:['en', 'ja', 'ru'], requires:['calendar-base', 'calendarnavigator']}); diff --git a/build/calendar/lang/calendar_ja.js b/build/calendar/lang/calendar_ja.js index b06df69976d..3d0b75f7673 100644 --- a/build/calendar/lang/calendar_ja.js +++ b/build/calendar/lang/calendar_ja.js @@ -1 +1 @@ -YUI.add("lang/calendar_ja",function(a){a.Intl.add("calendar","ja",{weekdays:["月曜日","火曜日","水曜日","木曜日","金曜日","土曜日","日曜日"],short_weekdays:["月曜","火曜","水曜","木曜","金曜","土曜","日曜"],very_short_weekdays:["月","火","水","木","金","土","日"]});},"@VERSION@"); \ No newline at end of file +YUI.add("lang/calendar_ja",function(a){a.Intl.add("calendar","ja",{weekdays:["\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5","\u65E5\u66DC\u65E5"],short_weekdays:["\u6708\u66DC","\u706B\u66DC","\u6C34\u66DC","\u6728\u66DC","\u91D1\u66DC","\u571F\u66DC","\u65E5\u66DC"],very_short_weekdays:["\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F","\u65E5"]});},"@VERSION@"); \ No newline at end of file diff --git a/build/console/lang/console_ja.js b/build/console/lang/console_ja.js index 9b29168c748..1b51ea75ed5 100644 --- a/build/console/lang/console_ja.js +++ b/build/console/lang/console_ja.js @@ -1 +1 @@ -YUI.add("lang/console_ja",function(a){a.Intl.add("console","ja",{title:"ログコンソール",pause:"一時停止",clear:"クリア",collapse:"閉じる",expand:"開く"});},"@VERSION@"); \ No newline at end of file +YUI.add("lang/console_ja",function(a){a.Intl.add("console","ja",{title:"\u30ED\u30B0\u30B3\u30F3\u30BD\u30FC\u30EB",pause:"\u4E00\u6642\u505C\u6B62",clear:"\u30AF\u30EA\u30A2",collapse:"\u9589\u3058\u308B",expand:"\u958B\u304F"});},"@VERSION@"); \ No newline at end of file diff --git a/build/datatype-date-format/datatype-date-format-debug.js b/build/datatype-date-format/datatype-date-format-debug.js index 43301f6aca7..d3672e674b8 100644 --- a/build/datatype-date-format/datatype-date-format-debug.js +++ b/build/datatype-date-format/datatype-date-format-debug.js @@ -5,6 +5,7 @@ YUI.add('datatype-date-format', function(Y) { * convenience methods for various JavaScript object types. * * @module datatype + * @main datatype */ /** diff --git a/build/datatype-date-format/datatype-date-format.js b/build/datatype-date-format/datatype-date-format.js index 4c4158f61b4..96214044864 100644 --- a/build/datatype-date-format/datatype-date-format.js +++ b/build/datatype-date-format/datatype-date-format.js @@ -5,6 +5,7 @@ YUI.add('datatype-date-format', function(Y) { * convenience methods for various JavaScript object types. * * @module datatype + * @main datatype */ /** diff --git a/build/datatype-date-format/lang/datatype-date-format_ja-JP.js b/build/datatype-date-format/lang/datatype-date-format_ja-JP.js index b4fe1b42de5..ea69a4bf39b 100644 --- a/build/datatype-date-format/lang/datatype-date-format_ja-JP.js +++ b/build/datatype-date-format/lang/datatype-date-format_ja-JP.js @@ -1 +1 @@ -YUI.add("lang/datatype-date-format_ja-JP",function(a){a.Intl.add("datatype-date-format","ja-JP",{"a":["日","月","火","水","木","金","土"],"A":["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],"b":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"B":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"c":"%Y年%m月%d日(%a)%k時%M分%S秒 %Z","p":["午前","午後"],"P":["午前","午後"],"x":"%y/%m/%d","X":"%k時%M分%S秒"});},"@VERSION@"); \ No newline at end of file +YUI.add("lang/datatype-date-format_ja-JP",function(a){a.Intl.add("datatype-date-format","ja-JP",{"a":["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],"A":["\u65E5\u66DC\u65E5","\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5"],"b":["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],"B":["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],"c":"%Y\u5E74%m\u6708%d\u65E5(%a)%k\u6642%M\u5206%S\u79D2 %Z","p":["\u5348\u524D","\u5348\u5F8C"],"P":["\u5348\u524D","\u5348\u5F8C"],"x":"%y/%m/%d","X":"%k\u6642%M\u5206%S\u79D2"});},"@VERSION@"); \ No newline at end of file diff --git a/build/datatype-date-format/lang/datatype-date-format_ja.js b/build/datatype-date-format/lang/datatype-date-format_ja.js index 24fc03d2d10..0068e6031a3 100644 --- a/build/datatype-date-format/lang/datatype-date-format_ja.js +++ b/build/datatype-date-format/lang/datatype-date-format_ja.js @@ -1 +1 @@ -YUI.add("lang/datatype-date-format_ja",function(a){a.Intl.add("datatype-date-format","ja",{"a":["日","月","火","水","木","金","土"],"A":["日曜日","月曜日","火曜日","水曜日","木曜日","金曜日","土曜日"],"b":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"B":["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"],"c":"%Y年%m月%d日(%a)%k時%M分%S秒 %Z","p":["午前","午後"],"P":["午前","午後"],"x":"%y/%m/%d","X":"%k時%M分%S秒"});},"@VERSION@"); \ No newline at end of file +YUI.add("lang/datatype-date-format_ja",function(a){a.Intl.add("datatype-date-format","ja",{"a":["\u65E5","\u6708","\u706B","\u6C34","\u6728","\u91D1","\u571F"],"A":["\u65E5\u66DC\u65E5","\u6708\u66DC\u65E5","\u706B\u66DC\u65E5","\u6C34\u66DC\u65E5","\u6728\u66DC\u65E5","\u91D1\u66DC\u65E5","\u571F\u66DC\u65E5"],"b":["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],"B":["1\u6708","2\u6708","3\u6708","4\u6708","5\u6708","6\u6708","7\u6708","8\u6708","9\u6708","10\u6708","11\u6708","12\u6708"],"c":"%Y\u5E74%m\u6708%d\u65E5(%a)%k\u6642%M\u5206%S\u79D2 %Z","p":["\u5348\u524D","\u5348\u5F8C"],"P":["\u5348\u524D","\u5348\u5F8C"],"x":"%y/%m/%d","X":"%k\u6642%M\u5206%S\u79D2"});},"@VERSION@"); \ No newline at end of file diff --git a/build/datatype-date-math/datatype-date-math-debug.js b/build/datatype-date-math/datatype-date-math-debug.js index 66f2ed873e5..ab733aae330 100644 --- a/build/datatype-date-math/datatype-date-math-debug.js +++ b/build/datatype-date-math/datatype-date-math-debug.js @@ -1,10 +1,10 @@ YUI.add('datatype-date-math', function(Y) { /** - * Parse number submodule. + * Datatype Date Math submodule. * * @module datatype - * @submodule datatype-date-parse + * @submodule datatype-date-math * @for DataType.Date */ var LANG = Y.Lang; @@ -27,19 +27,55 @@ Y.mix(Y.namespace("DataType.Date"), { return false; } }, - + + /** + * Checks whether two dates correspond to the same date and time. + * @for DataType.Date + * @method areEqual + * @param aDate {Date} The first date to compare. + * @param bDate {Date} The second date to compare. + * @return {Boolean} True if the two dates correspond to the same + * date and time. + */ areEqual : function (aDate, bDate) { return (this.isValidDate(aDate) && this.isValidDate(bDate) && (aDate.getTime() == bDate.getTime())); }, + /** + * Checks whether the first date comes later than the second. + * @for DataType.Date + * @method isGreater + * @param aDate {Date} The first date to compare. + * @param bDate {Date} The second date to compare. + * @return {Boolean} True if the first date is later than the second. + */ isGreater : function (aDate, bDate) { return (this.isValidDate(aDate) && this.isValidDate(bDate) && (aDate.getTime() > bDate.getTime())); }, + /** + * Checks whether the first date comes later than or is the same as + * the second. + * @for DataType.Date + * @method isGreaterOrEqual + * @param aDate {Date} The first date to compare. + * @param bDate {Date} The second date to compare. + * @return {Boolean} True if the first date is later than or + * the same as the second. + */ isGreaterOrEqual : function (aDate, bDate) { return (this.isValidDate(aDate) && this.isValidDate(bDate) && (aDate.getTime() >= bDate.getTime())); }, + /** + * Adds a specified number of months to the given date. + * @for DataType.Date + * @method addMonths + * @param oDate {Date} The date to add months to. + * @param numMonths {Number} The number of months to add (can be negative) + * @return {Date} A new Date with the specified number of months + * added to the original date. + */ addMonths : function (oDate, numMonths) { var newYear = oDate.getFullYear(); var newMonth = oDate.getMonth() + numMonths; @@ -53,7 +89,16 @@ Y.mix(Y.namespace("DataType.Date"), { return newDate; }, - + + /** + * Adds a specified number of years to the given date. + * @for DataType.Date + * @method addYears + * @param oDate {Date} The date to add years to. + * @param numYears {Number} The number of years to add (can be negative) + * @return {Date} A new Date with the specified number of years + * added to the original date. + */ addYears : function (oDate, numYears) { var newYear = oDate.getFullYear() + numYears; var newDate = new Date(oDate.getTime()); @@ -62,6 +107,14 @@ Y.mix(Y.namespace("DataType.Date"), { return newDate; }, + /** + * Lists all dates in a given month. + * @for DataType.Date + * @method listOfDatesInMonth + * @param oDate {Date} The date corresponding to the month for + * which a list of dates is required. + * @return {Array} An `Array` of `Date`s from a given month. + */ listOfDatesInMonth : function (oDate) { if (!this.isValidDate(oDate)) { return []; @@ -80,11 +133,14 @@ Y.mix(Y.namespace("DataType.Date"), { }, /** - * Takes a native JavaScript Date and returns the number of days in the month that the given date belongs to. + * Takes a native JavaScript Date and returns the number of days + * in the month that the given date belongs to. * @for DataType.Date * @method daysInMonth - * @param oDate {Date} Date in the month for which the number of days is desired. - * @return {Number} A number (either 28, 29, 30 or 31) of days in the given month. + * @param oDate {Date} Date in the month for which the number + * of days is desired. + * @return {Number} A number (either 28, 29, 30 or 31) of days + * in the given month. */ daysInMonth : function (oDate) { if (!this.isValidDate(oDate)) { diff --git a/build/datatype-date-math/datatype-date-math.js b/build/datatype-date-math/datatype-date-math.js index 3e86b75721b..0af35c11bae 100644 --- a/build/datatype-date-math/datatype-date-math.js +++ b/build/datatype-date-math/datatype-date-math.js @@ -1,10 +1,10 @@ YUI.add('datatype-date-math', function(Y) { /** - * Parse number submodule. + * Datatype Date Math submodule. * * @module datatype - * @submodule datatype-date-parse + * @submodule datatype-date-math * @for DataType.Date */ var LANG = Y.Lang; @@ -26,19 +26,55 @@ Y.mix(Y.namespace("DataType.Date"), { return false; } }, - + + /** + * Checks whether two dates correspond to the same date and time. + * @for DataType.Date + * @method areEqual + * @param aDate {Date} The first date to compare. + * @param bDate {Date} The second date to compare. + * @return {Boolean} True if the two dates correspond to the same + * date and time. + */ areEqual : function (aDate, bDate) { return (this.isValidDate(aDate) && this.isValidDate(bDate) && (aDate.getTime() == bDate.getTime())); }, + /** + * Checks whether the first date comes later than the second. + * @for DataType.Date + * @method isGreater + * @param aDate {Date} The first date to compare. + * @param bDate {Date} The second date to compare. + * @return {Boolean} True if the first date is later than the second. + */ isGreater : function (aDate, bDate) { return (this.isValidDate(aDate) && this.isValidDate(bDate) && (aDate.getTime() > bDate.getTime())); }, + /** + * Checks whether the first date comes later than or is the same as + * the second. + * @for DataType.Date + * @method isGreaterOrEqual + * @param aDate {Date} The first date to compare. + * @param bDate {Date} The second date to compare. + * @return {Boolean} True if the first date is later than or + * the same as the second. + */ isGreaterOrEqual : function (aDate, bDate) { return (this.isValidDate(aDate) && this.isValidDate(bDate) && (aDate.getTime() >= bDate.getTime())); }, + /** + * Adds a specified number of months to the given date. + * @for DataType.Date + * @method addMonths + * @param oDate {Date} The date to add months to. + * @param numMonths {Number} The number of months to add (can be negative) + * @return {Date} A new Date with the specified number of months + * added to the original date. + */ addMonths : function (oDate, numMonths) { var newYear = oDate.getFullYear(); var newMonth = oDate.getMonth() + numMonths; @@ -52,7 +88,16 @@ Y.mix(Y.namespace("DataType.Date"), { return newDate; }, - + + /** + * Adds a specified number of years to the given date. + * @for DataType.Date + * @method addYears + * @param oDate {Date} The date to add years to. + * @param numYears {Number} The number of years to add (can be negative) + * @return {Date} A new Date with the specified number of years + * added to the original date. + */ addYears : function (oDate, numYears) { var newYear = oDate.getFullYear() + numYears; var newDate = new Date(oDate.getTime()); @@ -61,6 +106,14 @@ Y.mix(Y.namespace("DataType.Date"), { return newDate; }, + /** + * Lists all dates in a given month. + * @for DataType.Date + * @method listOfDatesInMonth + * @param oDate {Date} The date corresponding to the month for + * which a list of dates is required. + * @return {Array} An `Array` of `Date`s from a given month. + */ listOfDatesInMonth : function (oDate) { if (!this.isValidDate(oDate)) { return []; @@ -79,11 +132,14 @@ Y.mix(Y.namespace("DataType.Date"), { }, /** - * Takes a native JavaScript Date and returns the number of days in the month that the given date belongs to. + * Takes a native JavaScript Date and returns the number of days + * in the month that the given date belongs to. * @for DataType.Date * @method daysInMonth - * @param oDate {Date} Date in the month for which the number of days is desired. - * @return {Number} A number (either 28, 29, 30 or 31) of days in the given month. + * @param oDate {Date} Date in the month for which the number + * of days is desired. + * @return {Number} A number (either 28, 29, 30 or 31) of days + * in the given month. */ daysInMonth : function (oDate) { if (!this.isValidDate(oDate)) {