Skip to content

Instantly share code, notes, and snippets.

@jimmydivvy
Created February 19, 2014 03:25
Show Gist options
  • Save jimmydivvy/9085514 to your computer and use it in GitHub Desktop.
Save jimmydivvy/9085514 to your computer and use it in GitHub Desktop.
moment.parseInTz = function () {
var args = [], i, len = arguments.length - 1;
for (i = 0; i < len; i++) {
args[i] = arguments[i];
}
var m = moment.apply(null, args);
var preTzOffset = m.zone();
m.tz(arguments[len]);
return m.add('minutes', m.zone() - preTzOffset);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment