Revision 5341,
2.6 KB
checked in by wmerlotto, 13 years ago
(diff) |
Ticket #2434 - Commit inicial do novo módulo de agenda do Expresso - expressoCalendar
|
Line | |
---|
1 | /**
|
---|
2 | * Version: 1.0 Alpha-1
|
---|
3 | * Build Date: 13-Nov-2007
|
---|
4 | * Copyright (c) 2006-2007, Coolite Inc. (http://www.coolite.com/). All rights reserved.
|
---|
5 | * License: Licensed under The MIT License. See license.txt and http://www.datejs.com/license/.
|
---|
6 | * Website: http://www.datejs.com/ or http://www.coolite.com/datejs/
|
---|
7 | */
|
---|
8 | Date.now=function(){return new Date();};Date.today=function(){return Date.now().clearTime();};Date.prototype._orient=+1;Date.prototype.next=function(){this._orient=+1;return this;};Date.prototype.last=Date.prototype.prev=Date.prototype.previous=function(){this._orient=-1;return this;};Date.prototype._is=false;Date.prototype.is=function(){this._is=true;return this;};Number.prototype._dateElement="day";Number.prototype.fromNow=function(){var c={};c[this._dateElement]=this;return Date.now().add(c);};Number.prototype.ago=function(){var c={};c[this._dateElement]=this*-1;return Date.now().add(c);};(function(){var $D=Date.prototype,$N=Number.prototype;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/),de;var df=function(n){return function(){if(this._is){this._is=false;return this.getDay()==n;} |
---|
9 | return this.moveToDayOfWeek(n,this._orient);};};for(var i=0;i<dx.length;i++){$D[dx[i]]=$D[dx[i].substring(0,3)]=df(i);} |
---|
10 | var mf=function(n){return function(){if(this._is){this._is=false;return this.getMonth()===n;} |
---|
11 | return this.moveToMonth(n,this._orient);};};for(var j=0;j<mx.length;j++){$D[mx[j]]=$D[mx[j].substring(0,3)]=mf(j);} |
---|
12 | var ef=function(j){return function(){if(j.substring(j.length-1)!="s"){j+="s";} |
---|
13 | return this["add"+j](this._orient);};};var nf=function(n){return function(){this._dateElement=n;return this;};};for(var k=0;k<px.length;k++){de=px[k].toLowerCase();$D[de]=$D[de+"s"]=ef(px[k]);$N[de]=$N[de+"s"]=nf(de);}}());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";}};
|
---|
Note: See
TracBrowser
for help on using the repository browser.