Skip to content

Instantly share code, notes, and snippets.

@chrishyle
Created July 9, 2009 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrishyle/143820 to your computer and use it in GitHub Desktop.
Save chrishyle/143820 to your computer and use it in GitHub Desktop.
// SC.DateTime additions:
// added to parse method --
case 'Z':
var modifier = scanner.scan(1);
if(modifier == 'Z'){
opts.timeZoneOffset = 0;
} else {
var timeZoneHours = scanner.scanInt(2);
if(scanner.scan(1) !== ':'){
scanner.scan(-1);
}
var timeZoneMinutes = scanner.scanInt(2);
var timeZoneSecondsOffset = (timeZoneHours*3600)+(timeZoneMinutes*60);
var offset = eval(0 + modifier + timeZoneSecondsOffset);
opts.timeZoneOffset = offset;
}
break;
// added to the first switch statement in _get --
case 'utc': return d.utcFormat();
//convience method for output--
toISO8601: function(){
var fmt = '%Y-%m-%dT%H:%M:%S%Z';
return this.constructor._toFormattedString(fmt, this._ms);
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment