Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created February 28, 2013 17:45
Show Gist options
  • Save tmcw/5058612 to your computer and use it in GitHub Desktop.
Save tmcw/5058612 to your computer and use it in GitHub Desktop.
require('https://raw.github.com/timrwood/moment/2.0.0/min/moment.min.js');
function m() {
var ops = {'+': 'add', '-': 'subtract'};
var args = Array.prototype
.slice
.call(arguments).map(function(a) {
if (!ops[a] && !a.utc) {
return moment(a);
} else return a;
});
}
m('3 days');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment