Comparing version 0.1.2 to 0.1.3
@@ -686,2 +686,5 @@ /* | ||
} | ||
if (obj.weeks !== undefined) { | ||
this.setDate(this.getDate() + (obj.weeks * 7)); | ||
} | ||
if (obj.months !== undefined) { | ||
@@ -688,0 +691,0 @@ this.setMonth(this.getMonth() + obj.months); |
@@ -23,2 +23,2 @@ /* | ||
*/(function(a){function k(a,b){a=String(a);while(a.length<b)a="0"+a;return a}function p(a,b){n.prototype[a]===undefined&&(n.prototype[a]=b)}function q(a){n.prototype[a]=function(){return this.date[a]()}}function r(a){n.prototype[a]=function(b){return this.date[a](b),this}}var b=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],c=["January","February","March","April","May","June","July","August","September","October","November","December"],d=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],e=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],f={su:0,sun:0,sunday:0,mo:1,mon:1,monday:1,tu:2,tue:2,tuesday:2,we:3,wed:3,wednesday:3,th:4,thu:4,thursday:4,fr:5,fri:5,friday:5,sa:6,sat:6,saturday:6},g=c.concat(b),h=["su","sun","sunday","mo","mon","monday","tu","tue","tuesday","we","wed","wednesday","th","thu","thursday","fr","fri","friday","sa","sat","saturday"],i={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11},j=[31,28,31,30,31,30,31,31,30,31,30,31],l=function(a){return a.match(/^(\d+)$/)?!0:!1},m=function(a,b,c,d){for(var e=d;e>=c;e--){var f=a.substring(b,b+e);if(f.length<c)return null;if(l(f))return f}return null},n=function(){var a=Array.prototype.slice.call(arguments);a.length===1?this.date=new Date(a[0]):a.length===3?this.date=new Date(a[0],a[1],a[2]):a.length===4?this.date=new Date(a[0],a[1],a[2],a[3]):a.length===5?this.date=new Date(a[0],a[1],a[2],a[3],a[4]):a.length===6?this.date=new Date(a[0],a[1],a[2],a[3],a[4],a[5]):a.length===7?this.date=new Date(a[0],a[1],a[2],a[3],a[4],a[5],a[6]):this.date=new Date};n.now=Date.now,n.UTC=Date.UTC;var o=function(a,b){a+="",b+="";var c=0,d=0,e="",f="",i="",j,k,l=new n,o=l.getYear(),p=l.getMonth()+1,q=1,r=0,s=0,t=0,u="";while(d<b.length){e=b.charAt(d),f="";while(b.charAt(d)===e&&d<b.length)f+=b.charAt(d++);if(f==="yyyy"||f==="yy"||f==="y"){f==="yyyy"&&(j=4,k=4),f==="yy"&&(j=2,k=2),f==="y"&&(j=2,k=4),o=m(a,c,j,k);if(o===null)return NaN;c+=o.length,o.length===2&&(o>70?o=1900+(o-0):o=2e3+(o-0))}else if(f==="MMM"||f==="NNN"){p=0;for(var v=0;v<g.length;v++){var w=g[v];if(a.substring(c,c+w.length).toLowerCase()===w.toLowerCase())if(f==="MMM"||f==="NNN"&&v>11){p=v+1,p>12&&(p-=12),c+=w.length;break}}if(p<1||p>12)return NaN}else if(f==="EE"||f==="E")for(var x=0;x<h.length;x++){var y=h[x];if(a.substring(c,c+y.length).toLowerCase()===y.toLowerCase()){c+=y.length;break}}else if(f==="MM"||f==="M"){p=m(a,c,f.length,2);if(p===null||p<1||p>12)return NaN;c+=p.length}else if(f==="dd"||f==="d"){q=m(a,c,f.length,2);if(q===null||q<1||q>31)return NaN;c+=q.length}else if(f==="hh"||f==="h"){r=m(a,c,f.length,2);if(r===null||r<1||r>12)return NaN;c+=r.length}else if(f==="HH"||f==="H"){r=m(a,c,f.length,2);if(r===null||r<0||r>23)return NaN;c+=r.length}else if(f==="KK"||f==="K"){r=m(a,c,f.length,2);if(r===null||r<0||r>11)return NaN;c+=r.length}else if(f==="kk"||f==="k"){r=m(a,c,f.length,2);if(r===null||r<1||r>24)return NaN;c+=r.length,r--}else if(f==="mm"||f==="m"){s=m(a,c,f.length,2);if(s===null||s<0||s>59)return NaN;c+=s.length}else if(f==="ss"||f==="s"){t=m(a,c,f.length,2);if(t===null||t<0||t>59)return NaN;c+=t.length}else if(f==="a"){if(a.substring(c,c+2).toLowerCase()==="am")u="AM";else{if(a.substring(c,c+2).toLowerCase()!=="pm")return NaN;u="PM"}c+=2}else{if(a.substring(c,c+f.length)!==f)return NaN;c+=f.length}}if(c!==a.length)return NaN;if(p===2)if(o%4===0&&o%100!==0||o%400===0){if(q>29)return NaN}else if(q>28)return NaN;if(p===4||p===6||p===9||p===11)if(q>30)return NaN;r<12&&u==="PM"?r=r-0+12:r>11&&u==="AM"&&(r-=12);var z=new Date(o,p-1,q,r,s,t);return z.getTime()};n.parse=function(a,b){if(b)return o(a,b);var c=Date.parse(a),d=0,e;return isNaN(c)&&(e=/^(\d{4}|[+\-]\d{6})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?))?/.exec(a))&&(e[8]!=="Z"&&(d=+e[10]*60+ +e[11],e[9]==="+"&&(d=0-d)),c=n.UTC(+e[1],+e[2]-1,+e[3],+e[4],+e[5]+d,+e[6],+e[7].substr(0,3))),c},n.today=function(){return(new n).clearTime()},n.UTCtoday=function(){return(new n).clearUTCTime()},n.tomorrow=function(){return n.today().add({days:1})},n.UTCtomorrow=function(){return n.UTCtoday().add({days:1})},n.yesterday=function(){return n.today().add({days:-1})},n.UTCyesterday=function(){return n.UTCtoday().add({days:-1})},n.validateDay=function(a,b,c){var d=new n(b,c,a);return d.getFullYear()===b&&d.getMonth()===c&&d.getDate()===a},n.validateYear=function(a){return a>=0&&a<=9999},n.validateSecond=function(a){return a>=0&&a<60},n.validateMonth=function(a){return a>=0&&a<12},n.validateMinute=function(a){return a>=0&&a<60},n.validateMillisecond=function(a){return a>=0&&a<1e3},n.validateHour=function(a){return a>=0&&a<24},n.compare=function(a,b){return a.valueOf()<b.valueOf()?-1:a.valueOf()>b.valueOf()?1:0},n.equals=function(a,b){return a.valueOf()===b.valueOf()},n.getDayNumberFromName=function(a){return f[a.toLowerCase()]},n.getMonthNumberFromName=function(a){return i[a.toLowerCase()]},n.isLeapYear=function(a){return(new n(a,1,29)).getDate()===29},n.getDaysInMonth=function(a,b){return b===1?n.isLeapYear(a)?29:28:j[b]},q("getDate"),q("getDay"),q("getFullYear"),q("getYear"),q("getMilliseconds"),q("getHours"),q("getMinutes"),q("getMonth"),q("getSeconds"),q("getTime"),q("getTimezoneOffset"),q("getUTCDate"),q("getUTCDay"),q("getUTCFullYear"),q("getUTCHours"),q("getUTCMilliseconds"),q("getUTCMinutes"),q("getUTCMonth"),q("getUTCSeconds"),r("setDate"),r("setFullYear"),r("setHours"),r("setMilliseconds"),r("setMinutes"),r("setMonth"),r("setSeconds"),r("setTime"),r("setUTCDate"),r("setUTCFullYear"),r("setUTCHours"),r("setUTCMilliseconds"),r("setUTCMinutes"),r("setUTCMonth"),r("setUTCSeconds"),q("toDateString"),q("toISOString"),q("toJSON"),q("toLocaleDateString"),q("toLocaleTimeString"),q("toString"),q("toTimeString"),q("toUTCString"),q("valueOf"),p("getMonthAbbr",function(){return b[this.getMonth()]}),p("getMonthName",function(){return c[this.getMonth()]}),p("getUTCOffset",function(){var a=k(Math.abs(this.getTimezoneOffset()/.6),4);return this.getTimezoneOffset()>0&&(a="-"+a),a}),p("toCLFString",function(){return k(this.getDate(),2)+"/"+this.getMonthAbbr()+"/"+this.getFullYear()+":"+k(this.getHours(),2)+":"+k(this.getMinutes(),2)+":"+k(this.getSeconds(),2)+" "+this.getUTCOffset()}),p("toYMD",function(a){return a=typeof a=="undefined"?"-":a,this.getUTCFullYear()+a+k(this.getUTCMonth()+1,2)+a+k(this.getUTCDate(),2)}),p("toDBString",function(){return this.getUTCFullYear()+"-"+k(this.getUTCMonth()+1,2)+"-"+k(this.getUTCDate(),2)+" "+k(this.getUTCHours(),2)+":"+k(this.getUTCMinutes(),2)+":"+k(this.getUTCSeconds(),2)}),p("clearTime",function(){return this.setHours(0),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0),this}),p("clearUTCTime",function(){return this.setUTCHours(0),this.setUTCMinutes(0),this.setUTCSeconds(0),this.setUTCMilliseconds(0),this}),p("add",function(a){return a.milliseconds!==undefined&&this.setMilliseconds(this.getMilliseconds()+a.milliseconds),a.seconds!==undefined&&this.setSeconds(this.getSeconds()+a.seconds),a.minutes!==undefined&&this.setMinutes(this.getMinutes()+a.minutes),a.hours!==undefined&&this.setHours(this.getHours()+a.hours),a.days!==undefined&&this.setDate(this.getDate()+a.days),a.months!==undefined&&this.setMonth(this.getMonth()+a.months),a.years!==undefined&&this.setFullYear(this.getFullYear()+a.years),this}),p("addMilliseconds",function(a){return this.add({milliseconds:a})}),p("addSeconds",function(a){return this.add({seconds:a})}),p("addMinutes",function(a){return this.add({minutes:a})}),p("addHours",function(a){return this.add({hours:a})}),p("addDays",function(a){return this.add({days:a})}),p("addWeeks",function(a){return this.add({days:a*7})}),p("addMonths",function(a){return this.add({months:a})}),p("addYears",function(a){return this.add({years:a})}),p("setTimeToNow",function(){var a=new Date;this.setMilliseconds(a.getMilliseconds()),this.setSeconds(a.getSeconds()),this.setMinutes(a.getMinutes()),this.setHours(a.getHours())}),p("clone",function(){return new n(this.valueOf())}),p("between",function(a,b){return this.valueOf()>=a.valueOf()&&this.valueOf()<=b.valueOf()}),p("compareTo",function(a){return n.compare(this,a)}),p("equals",function(a){return n.equals(this,a)}),p("isAfter",function(a){return a=a?a:new n,this.compareTo(a)>0}),p("isBefore",function(a){return a=a?a:new n,this.compareTo(a)<0}),p("getDaysBetween",function(a){return(a.clone().valueOf()-this.valueOf())/864e5|0}),p("getHoursBetween",function(a){return(a.clone().valueOf()-this.valueOf())/36e5|0}),p("getMinutesBetween",function(a){return(a.clone().valueOf()-this.valueOf())/6e4|0}),p("getSecondsBetween",function(a){return(a.clone().valueOf()-this.valueOf())/1e3|0}),p("getOrdinalNumber",function(){return Math.ceil((this.clone().clearTime()-new n(this.getFullYear(),0,1))/864e5)+1}),p("toFormat",function(a){var f=[a],g,h,i,j=function(a,b){var c=0,d=f.length,e,g,h,i=[];for(;c<d;c++)if(typeof f[c]=="string"){h=f[c].split(a);for(e=0,g=h.length-1;e<g;e++)i.push(h[e]),i.push([b]);i.push(h[g])}else i.push(f[c]);f=i},l=this.getHours()%12?this.getHours()%12:12;j("YYYY",this.getFullYear()),j("YY",String(this.getFullYear()).slice(-2)),j("MMMM",c[this.getMonth()]),j("MMM",b[this.getMonth()]),j("MM",k(this.getMonth()+1,2)),j("MI",k(this.getMinutes(),2)),j("M",this.getMonth()+1),j("DDDD",e[this.getDay()]),j("DDD",d[this.getDay()]),j("DD",k(this.getDate(),2)),j("D",this.getDate()),j("HH24",k(this.getHours(),2)),j("HH",k(l,2)),j("H",l),j("SS",k(this.getSeconds(),2)),j("PP",this.getHours()>=12?"PM":"AM"),j("P",this.getHours()>=12?"pm":"am"),j("LL",k(this.getMilliseconds(),3)),i="";for(h=f.length;g<h;g++)i+=typeof f[g]=="string"?f[g]:f[g][0];return f.join("")}),a.Object!==undefined?a.Cromag=n:exports=module.exports=n})(this); | ||
*/(function(e){function l(e,t){e=String(e);while(e.length<t)e="0"+e;return e}function v(e,t){p.prototype[e]===undefined&&(p.prototype[e]=t)}function m(e){p.prototype[e]=function(){return this.date[e]()}}function g(e){p.prototype[e]=function(t){return this.date[e](t),this}}var t=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],n=["January","February","March","April","May","June","July","August","September","October","November","December"],r=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],i=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],s={su:0,sun:0,sunday:0,mo:1,mon:1,monday:1,tu:2,tue:2,tuesday:2,we:3,wed:3,wednesday:3,th:4,thu:4,thursday:4,fr:5,fri:5,friday:5,sa:6,sat:6,saturday:6},o=n.concat(t),u=["su","sun","sunday","mo","mon","monday","tu","tue","tuesday","we","wed","wednesday","th","thu","thursday","fr","fri","friday","sa","sat","saturday"],a={jan:0,january:0,feb:1,february:1,mar:2,march:2,apr:3,april:3,may:4,jun:5,june:5,jul:6,july:6,aug:7,august:7,sep:8,september:8,oct:9,october:9,nov:10,november:10,dec:11,december:11},f=[31,28,31,30,31,30,31,31,30,31,30,31],c=function(e){return e.match(/^(\d+)$/)?!0:!1},h=function(e,t,n,r){for(var i=r;i>=n;i--){var s=e.substring(t,t+i);if(s.length<n)return null;if(c(s))return s}return null},p=function(){var e=Array.prototype.slice.call(arguments);e.length===1?this.date=new Date(e[0]):e.length===3?this.date=new Date(e[0],e[1],e[2]):e.length===4?this.date=new Date(e[0],e[1],e[2],e[3]):e.length===5?this.date=new Date(e[0],e[1],e[2],e[3],e[4]):e.length===6?this.date=new Date(e[0],e[1],e[2],e[3],e[4],e[5]):e.length===7?this.date=new Date(e[0],e[1],e[2],e[3],e[4],e[5],e[6]):this.date=new Date};p.now=Date.now,p.UTC=Date.UTC;var d=function(e,t){e+="",t+="";var n=0,r=0,i="",s="",a="",f,l,c=new p,d=c.getYear(),v=c.getMonth()+1,m=1,g=0,y=0,b=0,w="";while(r<t.length){i=t.charAt(r),s="";while(t.charAt(r)===i&&r<t.length)s+=t.charAt(r++);if(s==="yyyy"||s==="yy"||s==="y"){s==="yyyy"&&(f=4,l=4),s==="yy"&&(f=2,l=2),s==="y"&&(f=2,l=4),d=h(e,n,f,l);if(d===null)return NaN;n+=d.length,d.length===2&&(d>70?d=1900+(d-0):d=2e3+(d-0))}else if(s==="MMM"||s==="NNN"){v=0;for(var E=0;E<o.length;E++){var S=o[E];if(e.substring(n,n+S.length).toLowerCase()===S.toLowerCase())if(s==="MMM"||s==="NNN"&&E>11){v=E+1,v>12&&(v-=12),n+=S.length;break}}if(v<1||v>12)return NaN}else if(s==="EE"||s==="E")for(var x=0;x<u.length;x++){var T=u[x];if(e.substring(n,n+T.length).toLowerCase()===T.toLowerCase()){n+=T.length;break}}else if(s==="MM"||s==="M"){v=h(e,n,s.length,2);if(v===null||v<1||v>12)return NaN;n+=v.length}else if(s==="dd"||s==="d"){m=h(e,n,s.length,2);if(m===null||m<1||m>31)return NaN;n+=m.length}else if(s==="hh"||s==="h"){g=h(e,n,s.length,2);if(g===null||g<1||g>12)return NaN;n+=g.length}else if(s==="HH"||s==="H"){g=h(e,n,s.length,2);if(g===null||g<0||g>23)return NaN;n+=g.length}else if(s==="KK"||s==="K"){g=h(e,n,s.length,2);if(g===null||g<0||g>11)return NaN;n+=g.length}else if(s==="kk"||s==="k"){g=h(e,n,s.length,2);if(g===null||g<1||g>24)return NaN;n+=g.length,g--}else if(s==="mm"||s==="m"){y=h(e,n,s.length,2);if(y===null||y<0||y>59)return NaN;n+=y.length}else if(s==="ss"||s==="s"){b=h(e,n,s.length,2);if(b===null||b<0||b>59)return NaN;n+=b.length}else if(s==="a"){if(e.substring(n,n+2).toLowerCase()==="am")w="AM";else{if(e.substring(n,n+2).toLowerCase()!=="pm")return NaN;w="PM"}n+=2}else{if(e.substring(n,n+s.length)!==s)return NaN;n+=s.length}}if(n!==e.length)return NaN;if(v===2)if(d%4===0&&d%100!==0||d%400===0){if(m>29)return NaN}else if(m>28)return NaN;if(v===4||v===6||v===9||v===11)if(m>30)return NaN;g<12&&w==="PM"?g=g-0+12:g>11&&w==="AM"&&(g-=12);var N=new Date(d,v-1,m,g,y,b);return N.getTime()};p.parse=function(e,t){if(t)return d(e,t);var n=Date.parse(e),r=0,i;return isNaN(n)&&(i=/^(\d{4}|[+\-]\d{6})-(\d{2})-(\d{2})(?:[T ](\d{2}):(\d{2})(?::(\d{2})(?:\.(\d{3,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?))?/.exec(e))&&(i[8]!=="Z"&&(r=+i[10]*60+ +i[11],i[9]==="+"&&(r=0-r)),n=p.UTC(+i[1],+i[2]-1,+i[3],+i[4],+i[5]+r,+i[6],+i[7].substr(0,3))),n},p.today=function(){return(new p).clearTime()},p.UTCtoday=function(){return(new p).clearUTCTime()},p.tomorrow=function(){return p.today().add({days:1})},p.UTCtomorrow=function(){return p.UTCtoday().add({days:1})},p.yesterday=function(){return p.today().add({days:-1})},p.UTCyesterday=function(){return p.UTCtoday().add({days:-1})},p.validateDay=function(e,t,n){var r=new p(t,n,e);return r.getFullYear()===t&&r.getMonth()===n&&r.getDate()===e},p.validateYear=function(e){return e>=0&&e<=9999},p.validateSecond=function(e){return e>=0&&e<60},p.validateMonth=function(e){return e>=0&&e<12},p.validateMinute=function(e){return e>=0&&e<60},p.validateMillisecond=function(e){return e>=0&&e<1e3},p.validateHour=function(e){return e>=0&&e<24},p.compare=function(e,t){return e.valueOf()<t.valueOf()?-1:e.valueOf()>t.valueOf()?1:0},p.equals=function(e,t){return e.valueOf()===t.valueOf()},p.getDayNumberFromName=function(e){return s[e.toLowerCase()]},p.getMonthNumberFromName=function(e){return a[e.toLowerCase()]},p.isLeapYear=function(e){return(new p(e,1,29)).getDate()===29},p.getDaysInMonth=function(e,t){return t===1?p.isLeapYear(e)?29:28:f[t]},m("getDate"),m("getDay"),m("getFullYear"),m("getYear"),m("getMilliseconds"),m("getHours"),m("getMinutes"),m("getMonth"),m("getSeconds"),m("getTime"),m("getTimezoneOffset"),m("getUTCDate"),m("getUTCDay"),m("getUTCFullYear"),m("getUTCHours"),m("getUTCMilliseconds"),m("getUTCMinutes"),m("getUTCMonth"),m("getUTCSeconds"),g("setDate"),g("setFullYear"),g("setHours"),g("setMilliseconds"),g("setMinutes"),g("setMonth"),g("setSeconds"),g("setTime"),g("setUTCDate"),g("setUTCFullYear"),g("setUTCHours"),g("setUTCMilliseconds"),g("setUTCMinutes"),g("setUTCMonth"),g("setUTCSeconds"),m("toDateString"),m("toISOString"),m("toJSON"),m("toLocaleDateString"),m("toLocaleTimeString"),m("toString"),m("toTimeString"),m("toUTCString"),m("valueOf"),v("getMonthAbbr",function(){return t[this.getMonth()]}),v("getMonthName",function(){return n[this.getMonth()]}),v("getUTCOffset",function(){var e=l(Math.abs(this.getTimezoneOffset()/.6),4);return this.getTimezoneOffset()>0&&(e="-"+e),e}),v("toCLFString",function(){return l(this.getDate(),2)+"/"+this.getMonthAbbr()+"/"+this.getFullYear()+":"+l(this.getHours(),2)+":"+l(this.getMinutes(),2)+":"+l(this.getSeconds(),2)+" "+this.getUTCOffset()}),v("toYMD",function(e){return e=typeof e=="undefined"?"-":e,this.getUTCFullYear()+e+l(this.getUTCMonth()+1,2)+e+l(this.getUTCDate(),2)}),v("toDBString",function(){return this.getUTCFullYear()+"-"+l(this.getUTCMonth()+1,2)+"-"+l(this.getUTCDate(),2)+" "+l(this.getUTCHours(),2)+":"+l(this.getUTCMinutes(),2)+":"+l(this.getUTCSeconds(),2)}),v("clearTime",function(){return this.setHours(0),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0),this}),v("clearUTCTime",function(){return this.setUTCHours(0),this.setUTCMinutes(0),this.setUTCSeconds(0),this.setUTCMilliseconds(0),this}),v("add",function(e){return e.milliseconds!==undefined&&this.setMilliseconds(this.getMilliseconds()+e.milliseconds),e.seconds!==undefined&&this.setSeconds(this.getSeconds()+e.seconds),e.minutes!==undefined&&this.setMinutes(this.getMinutes()+e.minutes),e.hours!==undefined&&this.setHours(this.getHours()+e.hours),e.days!==undefined&&this.setDate(this.getDate()+e.days),e.weeks!==undefined&&this.setDate(this.getDate()+e.weeks*7),e.months!==undefined&&this.setMonth(this.getMonth()+e.months),e.years!==undefined&&this.setFullYear(this.getFullYear()+e.years),this}),v("addMilliseconds",function(e){return this.add({milliseconds:e})}),v("addSeconds",function(e){return this.add({seconds:e})}),v("addMinutes",function(e){return this.add({minutes:e})}),v("addHours",function(e){return this.add({hours:e})}),v("addDays",function(e){return this.add({days:e})}),v("addWeeks",function(e){return this.add({days:e*7})}),v("addMonths",function(e){return this.add({months:e})}),v("addYears",function(e){return this.add({years:e})}),v("setTimeToNow",function(){var e=new Date;this.setMilliseconds(e.getMilliseconds()),this.setSeconds(e.getSeconds()),this.setMinutes(e.getMinutes()),this.setHours(e.getHours())}),v("clone",function(){return new p(this.valueOf())}),v("between",function(e,t){return this.valueOf()>=e.valueOf()&&this.valueOf()<=t.valueOf()}),v("compareTo",function(e){return p.compare(this,e)}),v("equals",function(e){return p.equals(this,e)}),v("isAfter",function(e){return e=e?e:new p,this.compareTo(e)>0}),v("isBefore",function(e){return e=e?e:new p,this.compareTo(e)<0}),v("getDaysBetween",function(e){return(e.clone().valueOf()-this.valueOf())/864e5|0}),v("getHoursBetween",function(e){return(e.clone().valueOf()-this.valueOf())/36e5|0}),v("getMinutesBetween",function(e){return(e.clone().valueOf()-this.valueOf())/6e4|0}),v("getSecondsBetween",function(e){return(e.clone().valueOf()-this.valueOf())/1e3|0}),v("getOrdinalNumber",function(){return Math.ceil((this.clone().clearTime()-new p(this.getFullYear(),0,1))/864e5)+1}),v("toFormat",function(e){var s=[e],o,u,a,f=function(e,t){var n=0,r=s.length,i,o,u,a=[];for(;n<r;n++)if(typeof s[n]=="string"){u=s[n].split(e);for(i=0,o=u.length-1;i<o;i++)a.push(u[i]),a.push([t]);a.push(u[o])}else a.push(s[n]);s=a},c=this.getHours()%12?this.getHours()%12:12;f("YYYY",this.getFullYear()),f("YY",String(this.getFullYear()).slice(-2)),f("MMMM",n[this.getMonth()]),f("MMM",t[this.getMonth()]),f("MM",l(this.getMonth()+1,2)),f("MI",l(this.getMinutes(),2)),f("M",this.getMonth()+1),f("DDDD",i[this.getDay()]),f("DDD",r[this.getDay()]),f("DD",l(this.getDate(),2)),f("D",this.getDate()),f("HH24",l(this.getHours(),2)),f("HH",l(c,2)),f("H",c),f("SS",l(this.getSeconds(),2)),f("PP",this.getHours()>=12?"PM":"AM"),f("P",this.getHours()>=12?"pm":"am"),f("LL",l(this.getMilliseconds(),3)),a="";for(u=s.length;o<u;o++)a+=typeof s[o]=="string"?s[o]:s[o][0];return s.join("")}),e.Object!==undefined?e.Cromag=p:exports=module.exports=p})(this); |
@@ -5,3 +5,3 @@ { | ||
"description": "Date and Time Without the Monkeys", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"keywords": ["date", "time", "utils"], | ||
@@ -8,0 +8,0 @@ "homepage": "https://github.com/JerrySievert/cromagjs", |
@@ -266,2 +266,7 @@ var vows = require('vows'); | ||
assert.equal(topic.getMilliseconds(), 250); | ||
}, | ||
'using the add method works': function () { | ||
var topic = Cromag.today(); | ||
topic.add({ milliseconds: 500 }); | ||
assert.equal(topic.getMilliseconds(), 500); | ||
} | ||
@@ -282,2 +287,7 @@ }, | ||
assert.equal(topic.getSeconds(), 25); | ||
}, | ||
'using the add method works': function () { | ||
var topic = Cromag.today(); | ||
topic.add({ seconds: 50 }); | ||
assert.equal(topic.getSeconds(), 50); | ||
} | ||
@@ -298,2 +308,7 @@ }, | ||
assert.equal(topic.getMinutes(), 25); | ||
}, | ||
'using the add method works': function () { | ||
var topic = Cromag.today(); | ||
topic.add({ minutes: 50 }); | ||
assert.equal(topic.getMinutes(), 50); | ||
} | ||
@@ -314,2 +329,7 @@ }, | ||
assert.equal(topic.getHours(), 3); | ||
}, | ||
'using the add method works': function () { | ||
var topic = Cromag.today(); | ||
topic.add({ hours: 5 }); | ||
assert.equal(topic.getHours(), 5); | ||
} | ||
@@ -330,2 +350,7 @@ }, | ||
assert.equal(topic.getDate(), 9); | ||
}, | ||
'using the add method works': function () { | ||
var topic = new Cromag(2011, 0, 10); | ||
topic.add({ days: 1 }); | ||
assert.equal(topic.getDate(), 11); | ||
} | ||
@@ -346,2 +371,7 @@ }, | ||
assert.equal(topic.getDate(), 3); | ||
}, | ||
'using the add method works': function () { | ||
var topic = new Cromag(2011, 0, 10); | ||
topic.add({ weeks: 1 }); | ||
assert.equal(topic.getDate(), 17); | ||
} | ||
@@ -362,2 +392,7 @@ }, | ||
assert.equal(topic.getMonth(), 0); | ||
}, | ||
'using the add method works': function () { | ||
var topic = new Cromag(2011, 1, 10); | ||
topic.add({ months: 1 }); | ||
assert.equal(topic.getMonth(), 2); | ||
} | ||
@@ -364,0 +399,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
87898
1634
1