Permalink
Browse files

--------------------

2008-2-5 [geoffrey.mcgill]
1.  Added .is().weekday() function to sugarpak.js. 
    The .weekday() function determines if the current date is a weekday. 
    The function must be preceded by the .is() function.
    
    Example

    Date.today().is().weekday(); // true|false    

--------------------
  • Loading branch information...
1 parent 9b25d4f commit e56017a4b6516deef41c3cf4b4c416cf6d6d555f geoff@coolite.com committed Feb 6, 2008
Showing 325 changed files with 1,000 additions and 2,073 deletions.
View
@@ -1,6 +1,17 @@
CHANGE LOG
--------------------
+2008-2-5 [geoffrey.mcgill]
+1. Added .is().weekday() function to sugarpak.js.
+ The .weekday() function determines if the current date is a weekday.
+ The function must be preceded by the .is() function.
+
+ Example
+
+ Date.today().is().weekday(); // true|false
+
+--------------------
+
2008-2-4 [geoffrey.mcgill]
1. Added .getOrdinal() tests to the new sugarpak (/trunk/test/sugarpak/) test package.
See http://www.datejs.com/test/sugarpak/index.html
@@ -36,8 +47,8 @@ CHANGE LOG
Just trimming whitespace before sending string into parser fixed the problem.
-7. Added parser support for...
- "3 years ago"
+7. Added parser support for...
+ "3 years ago"
"7 hours ago"
--------------------
View
@@ -1,3 +1,5 @@
+The MIT License (http://www.opensource.org/licenses/mit-license.php)
+
Copyright (c) 2006-2008, Coolite Inc. (http://www.coolite.com/). All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
View
@@ -1 +1,7 @@
-More notes shortly...
+For a quick tutorial on getting started with Datejs, please visit the following links...
+
+http://www.datejs.com/2007/11/27/getting-started-with-datejs/
+
+http://code.google.com/p/datejs/
+
+Hope this helps!
View
@@ -1,7 +1,7 @@
/**
* @version: 1.0 Alpha-1
* @author: Coolite Inc. http://www.coolite.com/
- * @date: 2-Jan-2008
+ * @date: 5-Feb-2008
* @copyright: Copyright (c) 2006-2008, 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/
View
@@ -1,7 +1,7 @@
/**
* @version: 1.0 Alpha-1
* @author: Coolite Inc. http://www.coolite.com/
- * @date: 2-Jan-2008
+ * @date: 5-Feb-2008
* @copyright: Copyright (c) 2006-2008, 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/
@@ -33,9 +33,9 @@ return this;};$P.moveToFirstDayOfMonth=function(){return this.set({day:1});};$P.
return this.moveToFirstDayOfMonth().addDays(-1).moveToDayOfWeek(dayOfWeek,+1).addWeeks(shift);};$P.moveToDayOfWeek=function(dayOfWeek,orient){var diff=(dayOfWeek-this.getDay()+7*(orient||+1))%7;return this.addDays((diff===0)?diff+=7*(orient||+1):diff);};$P.moveToMonth=function(month,orient){var diff=(month-this.getMonth()+12*(orient||+1))%12;return this.addMonths((diff===0)?diff+=12*(orient||+1):diff);};$P.getDayOfYear=function(){return Math.floor((this-new Date(this.getFullYear(),0,1))/86400000);};$P.getWeekOfYear=function(firstDayOfWeek){var y=this.getFullYear(),m=this.getMonth(),d=this.getDate();var dow=firstDayOfWeek||$C.firstDayOfWeek;var offset=7+1-new Date(y,0,1).getDay();if(offset==8){offset=1;}
var daynum=(($D.UTC(y,m,d,0,0,0)-$D.UTC(y,0,1,0,0,0))/86400000)+1;var w=Math.floor((daynum-offset+7)/7);if(w===dow){y--;var prevOffset=7+1-new Date(y,0,1).getDay();if(prevOffset==2||prevOffset==8){w=53;}else{w=52;}}
return w;};$P.getTimezone=function(){return $D.getTimezoneAbbreviation(this.getUTCOffset());};$P.setTimezoneOffset=function(s){var here=this.getTimezoneOffset(),there=Number(s)*-6/10;return this.addMinutes(there-here);};$P.setTimezone=function(s){return this.setTimezoneOffset($D.getTimezoneOffset(s));};$P.hasDaylightSavingTime=function(){return(Date.today().set({month:0,day:1}).getTimezoneOffset()!==Date.today().set({month:6,day:1}).getTimezoneOffset());};$P.isDaylightSavingTime=function(){return(this.hasDaylightSavingTime()&&new Date().getTimezoneOffset()===Date.today().set({month:6,day:1}).getTimezoneOffset());};$P.getUTCOffset=function(){var n=this.getTimezoneOffset()*-10/6,r;if(n<0){r=(n-10000).toString();return r[0]+r.substr(2);}else{r=(n+10000).toString();return"+"+r.substr(1);}};$P.getElapsed=function(date){return(date||new Date())-this;};$P._toString=$P.toString;$P.toString=function(format){var x=this;var p=function p(s){return s<10?'0'+s:s;};return format?format.replace(/dd?d?d?|MM?M?M?|yy?y?y?|hh?|HH?|mm?|ss?|tt?|zz?z?/g,function(format){switch(format){case"hh":return p(x.getHours()<13?(x.getHours()===0?12:x.getHours()):(x.getHours()-12));case"h":return x.getHours()<13?(x.getHours()===0?12:x.getHours()):(x.getHours()-12);case"HH":return p(x.getHours());case"H":return x.getHours();case"mm":return p(x.getMinutes());case"m":return x.getMinutes();case"ss":return p(x.getSeconds());case"s":return x.getSeconds();case"yyyy":return x.getFullYear();case"yy":return x.getFullYear().toString().substring(2,4);case"dddd":return $C.dayNames[x.getDay()];case"ddd":return $C.abbreviatedDayNames[x.getDay()];case"dd":return p(x.getDate());case"d":return x.getDate().toString();case"MMMM":return $C.monthNames[x.getMonth()];case"MMM":return $C.abbreviatedMonthNames[x.getMonth()];case"MM":return p((x.getMonth()+1));case"M":return x.getMonth()+1;case"t":return x.getHours()<12?$C.amDesignator.substring(0,1):$C.pmDesignator.substring(0,1);case"tt":return x.getHours()<12?$C.amDesignator:$C.pmDesignator;case"zzz":case"zz":case"z":return"";}}):this._toString();};}());
-(function(){var $D=Date,$P=$D.prototype,$C=$D.CultureInfo,$N=Number.prototype,_isSecond=false;$P._orient=+1;$P._nth=null;$P._is=false;$N._dateElement="day";$P.next=function(){this._orient=+1;return this;};$D.next=function(){return $D.today().next();};$P.last=$P.prev=$P.previous=function(){this._orient=-1;return this;};$D.last=$D.prev=$D.previous=function(){return $D.today().last();};$P.is=function(){this._is=true;return this;};$P.at=function(time){return(typeof time==="string")?$D.parse(this.toShortDateString()+" "+time):this.set(time);};$N.fromNow=$N.after=function(date){var c={};c[this._dateElement]=this;return((!date)?new Date():date.clone()).add(c);};$N.ago=$N.before=function(date){var c={};c[this._dateElement]=this*-1;return((!date)?new Date():date.clone()).add(c);};var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),nth=("final first second third fourth fifth").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
+(function(){var $D=Date,$P=$D.prototype,$C=$D.CultureInfo,$N=Number.prototype,_isSecond=false;$P._orient=+1;$P._nth=null;$P._is=false;$N._dateElement="day";$P.next=function(){this._orient=+1;return this;};$D.next=function(){return $D.today().next();};$P.last=$P.prev=$P.previous=function(){this._orient=-1;return this;};$D.last=$D.prev=$D.previous=function(){return $D.today().last();};$P.is=function(){this._is=true;return this;};$P.at=function(time){return(typeof time==="string")?$D.parse(this.toShortDateString()+" "+time):this.set(time);};$P.weekday=function(){if(this._is){this._is=false;return(!this.is().sat()&&!this.is().sun());}};$N.fromNow=$N.after=function(date){var c={};c[this._dateElement]=this;return((!date)?new Date():date.clone()).add(c);};$N.ago=$N.before=function(date){var c={};c[this._dateElement]=this*-1;return((!date)?new Date():date.clone()).add(c);};var dx=("sunday monday tuesday wednesday thursday friday saturday").split(/\s/),mx=("january february march april may june july august september october november december").split(/\s/),px=("Millisecond Second Minute Hour Day Week Month Year").split(/\s/),nth=("final first second third fourth fifth").split(/\s/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;}
if(this._nth!==null){if(this._isSecond){this.addSeconds(this._orient*-1);}
-this._isSecond=false;var ntemp=this._nth;this._nth=null;var temp=this.clone().moveToLastDayOfMonth();this.moveToNthOccurrence(n,ntemp);if(this>temp){throw new RangeError($C.dayNames[n]+" does not occur "+ntemp+" times in the month of "+$C.monthNames[temp.getMonth()]+" "+temp.getFullYear()+".");}
+this._isSecond=false;var ntemp=this._nth;this._nth=null;var temp=this.clone().moveToLastDayOfMonth();this.moveToNthOccurrence(n,ntemp);if(this>temp){throw new RangeError($D.getDayName(n)+" does not occur "+ntemp+" times in the month of "+$D.getMonthName(temp.getMonth())+" "+temp.getFullYear()+".");}
return this;}
return this.moveToDayOfWeek(n,this._orient);};};var sdf=function(n){return function(){var t=$D.today(),shift=n-t.getDay();if(n===0&&$C.firstDayOfWeek===1&&t.getDay()!==0){shift=shift+7;}
return t.addDays(shift);};};for(var i=0;i<dx.length;i++){$D[dx[i].toUpperCase()]=$D[dx[i].toUpperCase().substring(0,3)]=i;$D[dx[i]]=$D[dx[i].substring(0,3)]=sdf(i);$P[dx[i]]=$P[dx[i].substring(0,3)]=df(i);}
@@ -47,15 +47,7 @@ return this["add"+j](this._orient);};};var nf=function(n){return function(){this
var nthfn=function(n){return function(dayOfWeek){if(dayOfWeek||dayOfWeek===0){return this.moveToNthOccurrence(dayOfWeek,n);}
this._nth=n;if(n===2&&(dayOfWeek===undefined||dayOfWeek===null)){this._isSecond=true;return this.addSeconds(this._orient);}
return this;};};for(var l=0;l<nth.length;l++){$P[nth[l]]=(l===0)?nthfn(-1):nthfn(l);}
-if(!$D.toISOString){$P.toISOString=function(){function f(n){return n<10?'0'+n:n;}
-return'"'+this.getUTCFullYear()+'-'+
-f(this.getUTCMonth()+1)+'-'+
-f(this.getUTCDate())+'T'+
-f(this.getUTCHours())+':'+
-f(this.getUTCMinutes())+':'+
-f(this.getUTCSeconds())+'Z"';};}
-if(!$D.toJSONString){$P.toJSONString=$P.toISOString;}
-$P.toShortDateString=function(){return this.toString($C.formatPatterns.shortDate);};$P.toLongDateString=function(){return this.toString($C.formatPatterns.longDate);};$P.toShortTimeString=function(){return this.toString($C.formatPatterns.shortTime);};$P.toLongTimeString=function(){return this.toString($C.formatPatterns.longTime);};$P.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";}};}());
+$P.toJSONString=function(){return this.toString("yyyy-MM-ddThh:mm:ssZ");};$P.toShortDateString=function(){return this.toString($C.formatPatterns.shortDate);};$P.toLongDateString=function(){return this.toString($C.formatPatterns.longDate);};$P.toShortTimeString=function(){return this.toString($C.formatPatterns.shortTime);};$P.toLongTimeString=function(){return this.toString($C.formatPatterns.longTime);};$P.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(s){this.message="Parse error at '"+s.substring(0,10)+" ...'";}};var $P=Date.Parsing;var _=$P.Operators={rtoken:function(r){return function(s){var mx=s.match(r);if(mx){return([mx[0],s.substring(mx[0].length)]);}else{throw new $P.Exception(s);}};},token:function(s){return function(s){return _.rtoken(new RegExp("^\s*"+s+"\s*"))(s);};},stoken:function(s){return _.rtoken(new RegExp("^"+s));},until:function(p){return function(s){var qx=[],rx=null;while(s.length){try{rx=p.call(this,s);}catch(e){qx.push(rx[0]);s=rx[1];continue;}
break;}
return[qx,s];};},many:function(p){return function(s){var rx=[],r=null;while(s.length){try{r=p.call(this,s);}catch(e){return[rx,s];}
Oops, something went wrong. Retry.

0 comments on commit e56017a

Please sign in to comment.