kanbanworkflowstimelinescrumrubyroadmapproject-planningproject-managementopenprojectangularissue-trackerifcgantt-chartganttbug-trackerboardsbcf
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
24 KiB
11 lines
24 KiB
/**
|
|
* Version: 1.0 Alpha-1
|
|
* Build Date: 13-Nov-2007
|
|
* Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
|
|
* License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
|
|
* Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
|
|
*/
|
|
Date.CultureInfo={name:"en-US",englishName:"English (United States)",nativeName:"English (United States)",dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],abbreviatedDayNames:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],shortestDayNames:["Su","Mo","Tu","We","Th","Fr","Sa"],firstLetterDayNames:["S","M","T","W","T","F","S"],monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],abbreviatedMonthNames:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],abbreviatedQuarterNames:["Q1","Q2","Q3","Q4"],quarterNames:["1st quarter","2nd quarter","3rd quarter","4th quarter"],amDesignator:"AM",pmDesignator:"PM",firstDayOfWeek:0,twoDigitYearMax:2029,dateElementOrder:"mdy",formatPatterns:{shortDate:"M/d/yyyy",longDate:"dddd, MMMM dd, yyyy",shortTime:"h:mm tt",longTime:"h:mm:ss tt",fullDateTime:"dddd, MMMM dd, yyyy h:mm:ss tt",sortableDateTime:"yyyy-MM-ddTHH:mm:ss",universalSortableDateTime:"yyyy-MM-dd HH:mm:ssZ",rfc1123:"ddd, dd MMM yyyy HH:mm:ss GMT",monthDay:"MMMM dd",yearMonth:"MMMM, yyyy"},regexPatterns:{jan:/^jan(uary)?/i,feb:/^feb(ruary)?/i,mar:/^mar(ch)?/i,apr:/^apr(il)?/i,may:/^may/i,jun:/^jun(e)?/i,jul:/^jul(y)?/i,aug:/^aug(ust)?/i,sep:/^sep(t(ember)?)?/i,oct:/^oct(ober)?/i,nov:/^nov(ember)?/i,dec:/^dec(ember)?/i,sun:/^su(n(day)?)?/i,mon:/^mo(n(day)?)?/i,tue:/^tu(e(s(day)?)?)?/i,wed:/^we(d(nesday)?)?/i,thu:/^th(u(r(s(day)?)?)?)?/i,fri:/^fr(i(day)?)?/i,sat:/^sa(t(urday)?)?/i,future:/^next/i,past:/^last|past|prev(ious)?/i,add:/^(\+|after|from)/i,subtract:/^(\-|before|ago)/i,yesterday:/^yesterday/i,today:/^t(oday)?/i,tomorrow:/^tomorrow/i,now:/^n(ow)?/i,millisecond:/^ms|milli(second)?s?/i,second:/^sec(ond)?s?/i,minute:/^min(ute)?s?/i,hour:/^h(ou)?rs?/i,week:/^w(ee)?k/i,month:/^m(o(nth)?s?)?/i,day:/^d(ays?)?/i,year:/^y((ea)?rs?)?/i,shortMeridian:/^(a|p)/i,longMeridian:/^(a\.?m?\.?|p\.?m?\.?)/i,timezone:/^((e(s|d)t|c(s|d)t|m(s|d)t|p(s|d)t)|((gmt)?\s*(\+|\-)\s*\d\d\d\d?)|gmt)/i,ordinalSuffix:/^\s*(st|nd|rd|th)/i,timeContext:/^\s*(\:|a|p)/i},abbreviatedTimeZoneStandard:{GMT:"-000",EST:"-0400",CST:"-0500",MST:"-0600",PST:"-0700"},abbreviatedTimeZoneDST:{GMT:"-000",EDT:"-0500",CDT:"-0600",MDT:"-0700",PDT:"-0800"}};
|
|
Date.getMonthNumberFromName=function(e){var t=Date.CultureInfo.monthNames,n=Date.CultureInfo.abbreviatedMonthNames,r=e.toLowerCase();for(var i=0;i<t.length;i++)if(t[i].toLowerCase()==r||n[i].toLowerCase()==r)return i;return-1},Date.getDayNumberFromName=function(e){var t=Date.CultureInfo.dayNames,n=Date.CultureInfo.abbreviatedDayNames,r=Date.CultureInfo.shortestDayNames,i=e.toLowerCase();for(var s=0;s<t.length;s++)if(t[s].toLowerCase()==i||n[s].toLowerCase()==i)return s;return-1},Date.isLeapYear=function(e){return e%4===0&&e%100!==0||e%400===0},Date.getDaysInMonth=function(e,t){return[31,Date.isLeapYear(e)?29:28,31,30,31,30,31,31,30,31,30,31][t]},Date.getTimezoneOffset=function(e,t){return t||!1?Date.CultureInfo.abbreviatedTimeZoneDST[e.toUpperCase()]:Date.CultureInfo.abbreviatedTimeZoneStandard[e.toUpperCase()]},Date.getTimezoneAbbreviation=function(e,t){var n=t||!1?Date.CultureInfo.abbreviatedTimeZoneDST:Date.CultureInfo.abbreviatedTimeZoneStandard,r;for(r in n)if(n[r]===e)return r;return null},Date.prototype.clone=function(){return new Date(this.getTime())},Date.prototype.compareTo=function(e){if(isNaN(this))throw new Error(this);if(e instanceof Date&&!isNaN(e))return this>e?1:this<e?-1:0;throw new TypeError(e)},Date.prototype.equals=function(e){return this.compareTo(e)===0},Date.prototype.between=function(e,t){var n=this.getTime();return n>=e.getTime()&&n<=t.getTime()},Date.prototype.addMilliseconds=function(e){return this.setMilliseconds(this.getMilliseconds()+e),this},Date.prototype.addSeconds=function(e){return this.addMilliseconds(e*1e3)},Date.prototype.addMinutes=function(e){return this.addMilliseconds(e*6e4)},Date.prototype.addHours=function(e){return this.addMilliseconds(e*36e5)},Date.prototype.addDays=function(e){return this.addMilliseconds(e*864e5)},Date.prototype.addWeeks=function(e){return this.addMilliseconds(e*6048e5)},Date.prototype.addMonths=function(e){var t=this.getDate();return this.setDate(1),this.setMonth(this.getMonth()+e),this.setDate(Math.min(t,this.getDaysInMonth())),this},Date.prototype.addQuarters=function(e){return this.addMonths(e*3)},Date.prototype.addYears=function(e){return this.addMonths(e*12)},Date.prototype.add=function(e){if(typeof e=="number")return this._orient=e,this;var t=e;return(t.millisecond||t.milliseconds)&&this.addMilliseconds(t.millisecond||t.milliseconds),(t.second||t.seconds)&&this.addSeconds(t.second||t.seconds),(t.minute||t.minutes)&&this.addMinutes(t.minute||t.minutes),(t.hour||t.hours)&&this.addHours(t.hour||t.hours),(t.month||t.months)&&this.addMonths(t.month||t.months),(t.year||t.years)&&this.addYears(t.year||t.years),(t.day||t.days)&&this.addDays(t.day||t.days),this},Date._validate=function(e,t,n,r){if(typeof e!="number")throw new TypeError(e+" is not a Number.");if(e<t||e>n)throw new RangeError(e+" is not a valid value for "+r+".");return!0},Date.validateMillisecond=function(e){return Date._validate(e,0,999,"milliseconds")},Date.validateSecond=function(e){return Date._validate(e,0,59,"seconds")},Date.validateMinute=function(e){return Date._validate(e,0,59,"minutes")},Date.validateHour=function(e){return Date._validate(e,0,23,"hours")},Date.validateDay=function(e,t,n){return Date._validate(e,1,Date.getDaysInMonth(t,n),"days")},Date.validateMonth=function(e){return Date._validate(e,0,11,"months")},Date.validateYear=function(e){return Date._validate(e,1,9999,"seconds")},Date.prototype.set=function(e){var t=e;return!t.millisecond&&t.millisecond!==0&&(t.millisecond=-1),!t.second&&t.second!==0&&(t.second=-1),!t.minute&&t.minute!==0&&(t.minute=-1),!t.hour&&t.hour!==0&&(t.hour=-1),!t.day&&t.day!==0&&(t.day=-1),!t.month&&t.month!==0&&(t.month=-1),!t.year&&t.year!==0&&(t.year=-1),t.millisecond!=-1&&Date.validateMillisecond(t.millisecond)&&this.addMilliseconds(t.millisecond-this.getMilliseconds()),t.second!=-1&&Date.validateSecond(t.second)&&this.addSeconds(t.second-this.getSeconds()),t.minute!=-1&&Date.validateMinute(t.minute)&&this.addMinutes(t.minute-this.getMinutes()),t.hour!=-1&&Date.validateHour(t.hour)&&this.addHours(t.hour-this.getHours()),t.month!==-1&&Date.validateMonth(t.month)&&this.addMonths(t.month-this.getMonth()),t.year!=-1&&Date.validateYear(t.year)&&this.addYears(t.year-this.getFullYear()),t.day!=-1&&Date.validateDay(t.day,this.getFullYear(),this.getMonth())&&this.addDays(t.day-this.getDate()),t.timezone&&this.setTimezone(t.timezone),t.timezoneOffset&&this.setTimezoneOffset(t.timezoneOffset),this},Date.prototype.clearTime=function(){return this.setHours(0),this.setMinutes(0),this.setSeconds(0),this.setMilliseconds(0),this},Date.prototype.isLeapYear=function(){var e=this.getFullYear();return e%4===0&&e%100!==0||e%400===0},Date.prototype.isWeekday=function(){return!this.is().sat()&&!this.is().sun()},Date.prototype.getDaysInMonth=function(){return Date.getDaysInMonth(this.getFullYear(),this.getMonth())},Date.prototype.getQuarter=function(){return Math.floor((this.getMonth()+1)/3)},Date.prototype.moveToFirstDayOfMonth=function(){return this.set({day:1})},Date.prototype.moveToLastDayOfMonth=function(){return this.set({day:this.getDaysInMonth()})},Date.prototype.moveToDayOfWeek=function(e,t){var n=(e-this.getDay()+7*(t||1))%7;return this.addDays(n===0?n+=7*(t||1):n)},Date.prototype.moveToMonth=function(e,t){var n=(e-this.getMonth()+12*(t||1))%12;return this.addMonths(n===0?n+=12*(t||1):n)},Date.prototype.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/864e5)},Date.prototype.getWeekOfYear=function(e){return this.getWeek();var t,n,r,i,s,o,u},Date.prototype.getWeek=function(e,t,n){var r,i,s,o,u,a,f,l,c,h,p=this;return Date.CultureInfo.firstDayOfWeek!==1&&(this.getDay()===0||!(this.getDay()<Date.CultureInfo.firstDayOfWeek))&&(p=(new Date(p)).next().monday()),e=e?e:p.getFullYear(),t=t?t:p.getMonth()+1,n=n?n:p.getDate(),t<=2?(r=e-1,i=(r/4|0)-(r/100|0)+(r/400|0),s=((r-1)/4|0)-((r-1)/100|0)+((r-1)/400|0),c=i-s,u=0,a=n-1+31*(t-1)):(r=e,i=(r/4|0)-(r/100|0)+(r/400|0),s=((r-1)/4|0)-((r-1)/100|0)+((r-1)/400|0),c=i-s,u=c+1,a=n+(153*(t-3)+2)/5+58+c),f=(r+i)%7,o=(a+f-u)%7,l=a+3-o|0,l<0?h=53-((f-c)/5|0):l>364+c?h=1:h=(l/7|0)+1,e=t=n=null,h},Date.prototype.getISOWeek=function(){var e=this.getUTCFullYear(),t=this.getUTCMonth()+1,n=this.getUTCDate();return this.getWeek(e,t,n)},Date.prototype.isDST=function(){return console.log("isDST"),this.toString().match(/(E|C|M|P)(S|D)T/)[2]=="D"},Date.prototype.getTimezone=function(){return Date.getTimezoneAbbreviation(this.getUTCOffset,this.isDST())},Date.prototype.setTimezoneOffset=function(e){var t=this.getTimezoneOffset(),n=Number(e)*-6/10;return this.addMinutes(n-t),this},Date.prototype.setTimezone=function(e){return this.setTimezoneOffset(Date.getTimezoneOffset(e))},Date.prototype.getUTCOffset=function(){var e=this.getTimezoneOffset()*-10/6,t;return e<0?(t=(e-1e4).toString(),t[0]+t.substr(2)):(t=(e+1e4).toString(),"+"+t.substr(1))},Date.prototype.getDayName=function(e){return e?Date.CultureInfo.abbreviatedDayNames[this.getDay()]:Date.CultureInfo.dayNames[this.getDay()]},Date.prototype.getMonthName=function(e){return e?Date.CultureInfo.abbreviatedMonthNames[this.getMonth()]:Date.CultureInfo.monthNames[this.getMonth()]},Date.prototype._toString=Date.prototype.toString,Date.prototype.toString=function(e){var t=this,n=function(t){return t.toString().length==1?"0"+t:t};return e?e.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(e){switch(e){case"hh":return n(t.getHours()<13?t.getHours():t.getHours()-12);case"h":return t.getHours()<13?t.getHours():t.getHours()-12;case"HH":return n(t.getHours());case"H":return t.getHours();case"mm":return n(t.getMinutes());case"m":return t.getMinutes();case"ss":return n(t.getSeconds());case"s":return t.getSeconds();case"yyyy":return t.getFullYear();case"yy":return t.getFullYear().toString().substring(2,4);case"dddd":return t.getDayName();case"ddd":return t.getDayName(!0);case"dd":return n(t.getDate());case"d":return t.getDate().toString();case"MMMM":return t.getMonthName();case"MMM":return t.getMonthName(!0);case"MM":return n(t.getMonth()+1);case"M":return t.getMonth()+1;case"t":return t.getHours()<12?Date.CultureInfo.amDesignator.substring(0,1):Date.CultureInfo.pmDesignator.substring(0,1);case"tt":return t.getHours()<12?Date.CultureInfo.amDesignator:Date.CultureInfo.pmDesignator;case"zzz":case"zz":case"z":return""}}):this._toString()};
|
|
Date.now=function(){return new Date},Date.today=function(){return Date.now().clearTime()},Date.prototype._orient=1,Date.prototype.next=function(){return this._orient=1,this},Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){return this._orient=-1,this},Date.prototype._is=!1,Date.prototype.is=function(){return this._is=!0,this},Number.prototype._dateElement="day",Number.prototype.fromNow=function(){var e={};return e[this._dateElement]=this,Date.now().add(e)},Number.prototype.ago=function(){var e={};return e[this._dateElement]=this*-1,Date.now().add(e)},function(){var e=Date.prototype,t=Number.prototype,n="sunday monday tuesday wednesday thursday friday saturday".split(/\s/),r="january february march april may june july august september october november december".split(/\s/),i="Millisecond Second Minute Hour Day Week Month Year".split(/\s/),s,o=function(e){return function(){return this._is?(this._is=!1,this.getDay()==e):this.moveToDayOfWeek(e,this._orient)}};for(var u=0;u<n.length;u++)e[n[u]]=e[n[u].substring(0,3)]=o(u);var a=function(e){return function(){return this._is?(this._is=!1,this.getMonth()===e):this.moveToMonth(e,this._orient)}};for(var f=0;f<r.length;f++)e[r[f]]=e[r[f].substring(0,3)]=a(f);var l=function(e){return function(){return e.substring(e.length-1)!="s"&&(e+="s"),this["add"+e](this._orient)}},c=function(e){return function(){return this._dateElement=e,this}};for(var h=0;h<i.length;h++)s=i[h].toLowerCase(),e[s]=e[s+"s"]=l(i[h]),t[s]=t[s+"s"]=c(s)}(),Date.prototype.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ")},Date.prototype.toShortDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortDatePattern)},Date.prototype.toLongDateString=function(){return this.toString(Date.CultureInfo.formatPatterns.longDatePattern)},Date.prototype.toShortTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.shortTimePattern)},Date.prototype.toLongTimeString=function(){return this.toString(Date.CultureInfo.formatPatterns.longTimePattern)},Date.prototype.getOrdinal=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th"}};
|
|
(function(){Date.Parsing={Exception:function(e){this.message="Parse error at '"+e.substring(0,10)+" ...'"}};var e=Date.Parsing,t=e.Operators={rtoken:function(t){return function(n){var i=n.match(t);if(i)return[i[0],n.substring(i[0].length)];throw new e.Exception(n)}},token:function(e){return function(e){return t.rtoken(new RegExp("^s*"+e+"s*"))(e)}},stoken:function(e){return t.rtoken(new RegExp("^"+e))},until:function(e){return function(t){var n=[],r=null;while(t.length){try{r=e.call(this,t)}catch(i){n.push(r[0]),t=r[1];continue}break}return[n,t]}},many:function(e){return function(t){var n=[],r=null;while(t.length){try{r=e.call(this,t)}catch(i){return[n,t]}n.push(r[0]),t=r[1]}return[n,t]}},optional:function(e){return function(t){var n=null;try{n=e.call(this,t)}catch(r){return[null,t]}return[n[0],n[1]]}},not:function(t){return function(n){try{t.call(this,n)}catch(r){return[null,n]}throw new e.Exception(n)}},ignore:function(e){return e?function(t){var n=null;return n=e.call(this,t),[null,n[1]]}:null},product:function(){var e=arguments[0],n=Array.prototype.slice.call(arguments,1),r=[];for(var i=0;i<e.length;i++)r.push(t.each(e[i],n));return r},cache:function(t){var n={},r=null;return function(i){try{r=n[i]=n[i]||t.call(this,i)}catch(s){r=n[i]=s}if(r instanceof e.Exception)throw r;return r}},any:function(){var t=arguments;return function(n){var r=null;for(var i=0;i<t.length;i++){if(t[i]==null)continue;try{r=t[i].call(this,n)}catch(s){r=null}if(r)return r}throw new e.Exception(n)}},each:function(){var t=arguments;return function(n){var r=[],i=null;for(var s=0;s<t.length;s++){if(t[s]==null)continue;try{i=t[s].call(this,n)}catch(o){throw new e.Exception(n)}r.push(i[0]),n=i[1]}return[r,n]}},all:function(){var e=arguments,t=t;return t.each(t.optional(e))},sequence:function(n,r,i){return r=r||t.rtoken(/^\s*/),i=i||null,n.length==1?n[0]:function(t){var s=null,o=null,u=[];for(var a=0;a<n.length;a++){try{s=n[a].call(this,t)}catch(f){break}u.push(s[0]);try{o=r.call(this,s[1])}catch(l){o=null;break}t=o[1]}if(!s)throw new e.Exception(t);if(o)throw new e.Exception(o[1]);if(i)try{s=i.call(this,s[1])}catch(h){throw new e.Exception(s[1])}return[u,s?s[1]:t]}},between:function(e,n,i){i=i||e;var s=t.each(t.ignore(e),n,t.ignore(i));return function(e){var t=s.call(this,e);return[[t[0][0],r[0][2]],t[1]]}},list:function(e,n,r){return n=n||t.rtoken(/^\s*/),r=r||null,e instanceof Array?t.each(t.product(e.slice(0,-1),t.ignore(n)),e.slice(-1),t.ignore(r)):t.each(t.many(t.each(e,t.ignore(n))),px,t.ignore(r))},set:function(n,r,i){return r=r||t.rtoken(/^\s*/),i=i||null,function(s){var o=null,u=null,a=null,f=null,l=[[],s],h=!1;for(var p=0;p<n.length;p++){a=null,u=null,o=null,h=n.length==1;try{o=n[p].call(this,s)}catch(v){continue}f=[[o[0]],o[1]];if(o[1].length>0&&!h)try{a=r.call(this,o[1])}catch(m){h=!0}else h=!0;!h&&a[1].length===0&&(h=!0);if(!h){var g=[];for(var y=0;y<n.length;y++)p!=y&&g.push(n[y]);u=t.set(g,r).call(this,a[1]),u[0].length>0&&(f[0]=f[0].concat(u[0]),f[1]=u[1])}f[1].length<l[1].length&&(l=f);if(l[1].length===0)break}if(l[0].length===0)return l;if(i){try{a=i.call(this,l[1])}catch(b){throw new e.Exception(l[1])}l[1]=a[1]}return l}},forward:function(e,t){return function(n){return e[t].call(this,n)}},replace:function(e,t){return function(n){var r=e.call(this,n);return[t,r[1]]}},process:function(e,t){return function(n){var r=e.call(this,n);return[t.call(this,r[0]),r[1]]}},min:function(t,n){return function(r){var i=n.call(this,r);if(i[0].length<t)throw new e.Exception(r);return i}}},n=function(e){return function(){var t=null,n=[];arguments.length>1?t=Array.prototype.slice.call(arguments):arguments[0]instanceof Array&&(t=arguments[0]);if(!t)return e.apply(null,arguments);for(var r=0,i=t.shift();r<i.length;r++)return t.unshift(i[r]),n.push(e.apply(null,t)),t.shift(),n}},i="optional not ignore cache".split(/\s/);for(var s=0;s<i.length;s++)t[i[s]]=n(t[i[s]]);var o=function(e){return function(){return arguments[0]instanceof Array?e.apply(null,arguments[0]):e.apply(null,arguments)}},u="each any all".split(/\s/);for(var a=0;a<u.length;a++)t[u[a]]=o(t[u[a]])})(),function(){var e=function(t){var n=[];for(var r=0;r<t.length;r++)t[r]instanceof Array?n=n.concat(e(t[r])):t[r]&&n.push(t[r]);return n};Date.Grammar={},Date.Translator={hour:function(e){return function(){this.hour=Number(e)}},minute:function(e){return function(){this.minute=Number(e)}},second:function(e){return function(){this.second=Number(e)}},meridian:function(e){return function(){this.meridian=e.slice(0,1).toLowerCase()}},timezone:function(e){return function(){var t=e.replace(/[^\d\+\-]/g,"");t.length?this.timezoneOffset=Number(t):this.timezone=e.toLowerCase()}},day:function(e){var t=e[0];return function(){this.day=Number(t.match(/\d+/)[0])}},month:function(e){return function(){this.month=e.length==3?Date.getMonthNumberFromName(e):Number(e)-1}},year:function(e){return function(){var t=Number(e);this.year=e.length>2?t:t+(t+2e3<Date.CultureInfo.twoDigitYearMax?2e3:1900)}},rday:function(e){return function(){switch(e){case"yesterday":this.days=-1;break;case"tomorrow":this.days=1;break;case"today":this.days=0;break;case"now":this.days=0,this.now=!0}}},finishExact:function(e){e=e instanceof Array?e:[e];var t=new Date;this.year=t.getFullYear(),this.month=t.getMonth(),this.day=1,this.hour=0,this.minute=0,this.second=0;for(var n=0;n<e.length;n++)e[n]&&e[n].call(this);this.hour=this.meridian=="p"&&this.hour<13?this.hour+12:this.hour;if(this.day>Date.getDaysInMonth(this.year,this.month))throw new RangeError(this.day+" is not a valid value for days.");var r=new Date(this.year,this.month,this.day,this.hour,this.minute,this.second);return this.timezone?r.set({timezone:this.timezone}):this.timezoneOffset&&r.set({timezoneOffset:this.timezoneOffset}),r},finish:function(t){t=t instanceof Array?e(t):[t];if(t.length===0)return null;for(var n=0;n<t.length;n++)typeof t[n]=="function"&&t[n].call(this);if(this.now)return new Date;var r=Date.today(),i=null,s=this.days!=null||!!this.orient||!!this.operator;if(s){var o,u,a;a=this.orient=="past"||this.operator=="subtract"?-1:1,this.weekday&&(this.unit="day",o=Date.getDayNumberFromName(this.weekday)-r.getDay(),u=7,this.days=o?(o+a*u)%u:a*u),this.month&&(this.unit="month",o=this.month-r.getMonth(),u=12,this.months=o?(o+a*u)%u:a*u,this.month=null),this.unit||(this.unit="day");if(this[this.unit+"s"]==null||this.operator!=null)this.value||(this.value=1),this.unit=="week"&&(this.unit="day",this.value=this.value*7),this[this.unit+"s"]=this.value*a;return r.add(this)}return this.meridian&&this.hour&&(this.hour=this.hour<13&&this.meridian=="p"?this.hour+12:this.hour),this.weekday&&!this.day&&(this.day=r.addDays(Date.getDayNumberFromName(this.weekday)-r.getDay()).getDate()),this.month&&!this.day&&(this.day=1),r.set(this)}};var t=Date.Parsing.Operators,n=Date.Grammar,r=Date.Translator,i;n.datePartDelimiter=t.rtoken(/^([\s\-\.\,\/\x27]+)/),n.timePartDelimiter=t.stoken(":"),n.whiteSpace=t.rtoken(/^\s*/),n.generalDelimiter=t.rtoken(/^(([\s\,]|at|on)+)/);var s={};n.ctoken=function(e){var n=s[e];if(!n){var r=Date.CultureInfo.regexPatterns,i=e.split(/\s+/),o=[];for(var u=0;u<i.length;u++)o.push(t.replace(t.rtoken(r[i[u]]),i[u]));n=s[e]=t.any.apply(null,o)}return n},n.ctoken2=function(e){return t.rtoken(Date.CultureInfo.regexPatterns[e])},n.h=t.cache(t.process(t.rtoken(/^(0[0-9]|1[0-2]|[1-9])/),r.hour)),n.hh=t.cache(t.process(t.rtoken(/^(0[0-9]|1[0-2])/),r.hour)),n.H=t.cache(t.process(t.rtoken(/^([0-1][0-9]|2[0-3]|[0-9])/),r.hour)),n.HH=t.cache(t.process(t.rtoken(/^([0-1][0-9]|2[0-3])/),r.hour)),n.m=t.cache(t.process(t.rtoken(/^([0-5][0-9]|[0-9])/),r.minute)),n.mm=t.cache(t.process(t.rtoken(/^[0-5][0-9]/),r.minute)),n.s=t.cache(t.process(t.rtoken(/^([0-5][0-9]|[0-9])/),r.second)),n.ss=t.cache(t.process(t.rtoken(/^[0-5][0-9]/),r.second)),n.hms=t.cache(t.sequence([n.H,n.mm,n.ss],n.timePartDelimiter)),n.t=t.cache(t.process(n.ctoken2("shortMeridian"),r.meridian)),n.tt=t.cache(t.process(n.ctoken2("longMeridian"),r.meridian)),n.z=t.cache(t.process(t.rtoken(/^(\+|\-)?\s*\d\d\d\d?/),r.timezone)),n.zz=t.cache(t.process(t.rtoken(/^(\+|\-)\s*\d\d\d\d/),r.timezone)),n.zzz=t.cache(t.process(n.ctoken2("timezone"),r.timezone)),n.timeSuffix=t.each(t.ignore(n.whiteSpace),t.set([n.tt,n.zzz])),n.time=t.each(t.optional(t.ignore(t.stoken("T"))),n.hms,n.timeSuffix),n.d=t.cache(t.process(t.each(t.rtoken(/^([0-2]\d|3[0-1]|\d)/),t.optional(n.ctoken2("ordinalSuffix"))),r.day)),n.dd=t.cache(t.process(t.each(t.rtoken(/^([0-2]\d|3[0-1])/),t.optional(n.ctoken2("ordinalSuffix"))),r.day)),n.ddd=n.dddd=t.cache(t.process(n.ctoken("sun mon tue wed thu fri sat"),function(e){return function(){this.weekday=e}})),n.M=t.cache(t.process(t.rtoken(/^(1[0-2]|0\d|\d)/),r.month)),n.MM=t.cache(t.process(t.rtoken(/^(1[0-2]|0\d)/),r.month)),n.MMM=n.MMMM=t.cache(t.process(n.ctoken("jan feb mar apr may jun jul aug sep oct nov dec"),r.month)),n.y=t.cache(t.process(t.rtoken(/^(\d\d?)/),r.year)),n.yy=t.cache(t.process(t.rtoken(/^(\d\d)/),r.year)),n.yyy=t.cache(t.process(t.rtoken(/^(\d\d?\d?\d?)/),r.year)),n.yyyy=t.cache(t.process(t.rtoken(/^(\d\d\d\d)/),r.year)),i=function(){return t.each(t.any.apply(null,arguments),t.not(n.ctoken2("timeContext")))},n.day=i(n.d,n.dd),n.month=i(n.M,n.MMM),n.year=i(n.yyyy,n.yy),n.orientation=t.process(n.ctoken("past future"),function(e){return function(){this.orient=e}}),n.operator=t.process(n.ctoken("add subtract"),function(e){return function(){this.operator=e}}),n.rday=t.process(n.ctoken("yesterday tomorrow today now"),r.rday),n.unit=t.process(n.ctoken("minute hour day week month year"),function(e){return function(){this.unit=e}}),n.value=t.process(t.rtoken(/^\d\d?(st|nd|rd|th)?/),function(e){return function(){this.value=e.replace(/\D/g,"")}}),n.expression=t.set([n.rday,n.operator,n.value,n.unit,n.orientation,n.ddd,n.MMM]),i=function(){return t.set(arguments,n.datePartDelimiter)},n.mdy=i(n.ddd,n.month,n.day,n.year),n.ymd=i(n.ddd,n.year,n.month,n.day),n.dmy=i(n.ddd,n.day,n.month,n.year),n.date=function(e){return(n[Date.CultureInfo.dateElementOrder]||n.mdy).call(this,e)},n.format=t.process(t.many(t.any(t.process(t.rtoken(/^(dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?)/),function(e){if(n[e])return n[e];throw Date.Parsing.Exception(e)}),t.process(t.rtoken(/^[^dMyhHmstz]+/),function(e){return t.ignore(t.stoken(e))}))),function(e){return t.process(t.each.apply(null,e),r.finishExact)});var o={},u=function(e){return o[e]=o[e]||n.format(e)[0]};n.formats=function(e){if(e instanceof Array){var n=[];for(var r=0;r<e.length;r++)n.push(u(e[r]));return t.any.apply(null,n)}return u(e)},n._formats=n.formats(["yyyy-MM-ddTHH:mm:ss","ddd, MMM dd, yyyy H:mm:ss tt","ddd MMM d yyyy HH:mm:ss zzz","d"]),n._start=t.process(t.set([n.date,n.time,n.expression],n.generalDelimiter,n.whiteSpace),r.finish),n.start=function(e){try{var t=n._formats.call({},e);if(t[1].length===0)return t}catch(r){}return n._start.call({},e)}}(),Date._parse=Date.parse,Date.slowParse=function(e){var t=null;if(!e)return null;try{t=Date.Grammar.start.call({},e)}catch(n){return null}return t[1].length===0?t[0]:null},Date.parse=function(e){if(!e)return undefined;var t=new Date(e);window.isNaN(t)&&(t=new Date(e.replace(/-/g,"/")));if(window.isNaN(t))try{r=Date.Grammar.start.call({},s),t=r[1].length===0?r[0]:NaN}catch(n){t=NaN}return window.isNaN(t)?null:(t.clearTime(),t)},Date.getParseFunction=function(e){var t=Date.Grammar.formats(e);return function(e){var n=null;try{n=t.call({},e)}catch(r){return null}return n[1].length===0?n[0]:null}},Date.parseExact=function(e,t){return Date.getParseFunction(t)(e)}; |