-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprimer.min.js
3 lines (3 loc) · 1.26 KB
/
primer.min.js
1
2
3
(function(){function e(){Date=c}function f(){Date=b}var b=Date,d=0,c=function(){var a=Array.prototype.slice.call(arguments,0);1!==a.length||a[0]||(a=[]);switch(a.length){case 0:a=new b(b.now()+d);break;case 1:a=new b(a[0]);break;case 2:a=new b(a[0],a[1]);break;case 3:a=new b(a[0],a[1],a[2]);break;case 4:a=new b(a[0],a[1],a[2],a[3]);break;case 5:a=new b(a[0],a[1],a[2],a[3],a[4]);break;case 6:a=new b(a[0],a[1],a[2],a[3],a[4],a[5]);break;case 7:a=new b(a[0],a[1],a[2],a[3],a[4],a[5],a[6]);break;default:throw Error("You've passed too many arguments to the `Date` constructor.");
}return this instanceof b?a:a.toString()};c.prototype=b.prototype;c.now=function(){return b.now()+d};c.parse=b.parse;c.UTC=b.UTC;c.setTime=function(a,c){if(c)if("number"===typeof a)d=a;else throw Error("The different for `setTime` must be a number.");else if(a instanceof Date)d=a.getTime()-b.now();else if("string"===typeof a||"number"===typeof a)d=(new b(a)).getTime()-b.now();else throw Error("`setTime` accepts a Date instance, a string date or a timestamp.");};c.resetTime=function(){d=0};"function"===
typeof define&&define.amd?define("primer",[],function(){return{enable:e,disable:f}}):"object"===typeof exports?(module.exports.enable=e,module.exports.disable=f):(Date.enablePrimer=e,c.disablePrimer=f)})();