/* Packed
 *
 * libs/mochikit/DateTime.js
 *
 */
if(typeof (dojo)!="undefined"){
dojo.provide("MochiKit.DateTime");
}
if(typeof (MochiKit)=="undefined"){
MochiKit={};
}
if(typeof (MochiKit.DateTime)=="undefined"){
MochiKit.DateTime={};
}
MochiKit.DateTime.NAME="MochiKit.DateTime";
MochiKit.DateTime.VERSION="1.4";
MochiKit.DateTime.__repr__=function(){
return "["+this.NAME+" "+this.VERSION+"]";
};
MochiKit.DateTime.toString=function(){
return this.__repr__();
};
MochiKit.DateTime.isoDate=function(_1){
_1=_1+"";
if(typeof (_1)!="string"||_1.length===0){
return null;
}
var _2=_1.split("-");
if(_2.length===0){
return null;
}
return new Date(_2[0],_2[1]-1,_2[2]);
};
MochiKit.DateTime._isoRegexp=/(\d{4,})(?:-(\d{1,2})(?:-(\d{1,2})(?:[T ](\d{1,2}):(\d{1,2})(?::(\d{1,2})(?:\.(\d+))?)?(?:(Z)|([+-])(\d{1,2})(?::(\d{1,2}))?)?)?)?)?/;
MochiKit.DateTime.isoTimestamp=function(_3){
_3=_3+"";
if(typeof (_3)!="string"||_3.length===0){
return null;
}
var _4=_3.match(MochiKit.DateTime._isoRegexp);
if(typeof (_4)=="undefined"||_4===null){
return null;
}
var _5,_6,_7,_8,_9,_a,_b;
_5=parseInt(_4[1],10);
if(typeof (_4[2])=="undefined"||_4[2]===""){
return new Date(_5);
}
_6=parseInt(_4[2],10)-1;
_7=parseInt(_4[3],10);
if(typeof (_4[4])=="undefined"||_4[4]===""){
return new Date(_5,_6,_7);
}
_8=parseInt(_4[4],10);
_9=parseInt(_4[5],10);
_a=(typeof (_4[6])!="undefined"&&_4[6]!=="")?parseInt(_4[6],10):0;
if(typeof (_4[7])!="undefined"&&_4[7]!==""){
_b=Math.round(1000*parseFloat("0."+_4[7]));
}else{
_b=0;
}
if((typeof (_4[8])=="undefined"||_4[8]==="")&&(typeof (_4[9])=="undefined"||_4[9]==="")){
return new Date(_5,_6,_7,_8,_9,_a,_b);
}
var _c;
if(typeof (_4[9])!="undefined"&&_4[9]!==""){
_c=parseInt(_4[10],10)*3600000;
if(typeof (_4[11])!="undefined"&&_4[11]!==""){
_c+=parseInt(_4[11],10)*60000;
}
if(_4[9]=="-"){
_c=-_c;
}
}else{
_c=0;
}
return new Date(Date.UTC(_5,_6,_7,_8,_9,_a,_b)-_c);
};
MochiKit.DateTime.toISOTime=function(_d,_e){
if(typeof (_d)=="undefined"||_d===null){
return null;
}
var hh=_d.getHours();
var mm=_d.getMinutes();
var ss=_d.getSeconds();
var lst=[((_e&&(hh<10))?"0"+hh:hh),((mm<10)?"0"+mm:mm),((ss<10)?"0"+ss:ss)];
return lst.join(":");
};
MochiKit.DateTime.toISOTimestamp=function(_13,_14){
if(typeof (_13)=="undefined"||_13===null){
return null;
}
var sep=_14?"T":" ";
var _16=_14?"Z":"";
if(_14){
_13=new Date(_13.getTime()+(_13.getTimezoneOffset()*60000));
}
return MochiKit.DateTime.toISODate(_13)+sep+MochiKit.DateTime.toISOTime(_13,_14)+_16;
};
MochiKit.DateTime.toISODate=function(_17){
if(typeof (_17)=="undefined"||_17===null){
return null;
}
var _18=MochiKit.DateTime._padTwo;
return [_17.getFullYear(),_18(_17.getMonth()+1),_18(_17.getDate())].join("-");
};
MochiKit.DateTime.americanDate=function(d){
d=d+"";
if(typeof (d)!="string"||d.length===0){
return null;
}
var a=d.split("/");
return new Date(a[2],a[0]-1,a[1]);
};
MochiKit.DateTime._padTwo=function(n){
return (n>9)?n:"0"+n;
};
MochiKit.DateTime.toPaddedAmericanDate=function(d){
if(typeof (d)=="undefined"||d===null){
return null;
}
var _1d=MochiKit.DateTime._padTwo;
return [_1d(d.getMonth()+1),_1d(d.getDate()),d.getFullYear()].join("/");
};
MochiKit.DateTime.toAmericanDate=function(d){
if(typeof (d)=="undefined"||d===null){
return null;
}
return [d.getMonth()+1,d.getDate(),d.getFullYear()].join("/");
};
MochiKit.DateTime.EXPORT=["isoDate","isoTimestamp","toISOTime","toISOTimestamp","toISODate","americanDate","toPaddedAmericanDate","toAmericanDate"];
MochiKit.DateTime.EXPORT_OK=[];
MochiKit.DateTime.EXPORT_TAGS={":common":MochiKit.DateTime.EXPORT,":all":MochiKit.DateTime.EXPORT};
MochiKit.DateTime.__new__=function(){
var _1f=this.NAME+".";
for(var k in this){
var o=this[k];
if(typeof (o)=="function"&&typeof (o.NAME)=="undefined"){
try{
o.NAME=_1f+k;
}
catch(e){
}
}
}
};
MochiKit.DateTime.__new__();
if(typeof (MochiKit.Base)!="undefined"){
MochiKit.Base._exportSymbols(this,MochiKit.DateTime);
}else{
(function(_22,_23){
if((typeof (JSAN)=="undefined"&&typeof (dojo)=="undefined")||(MochiKit.__export__===false)){
var all=_23.EXPORT_TAGS[":all"];
for(var i=0;i<all.length;i++){
_22[all[i]]=_23[all[i]];
}
}
})(this,MochiKit.DateTime);
}



