-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
1 lines (1 loc) · 3.07 KB
/
index.js
1
!function(e,n){"object"==typeof exports&&"object"==typeof module?module.exports=n():"function"==typeof define&&define.amd?define("Timean",[],n):"object"==typeof exports?exports.Timean=n():e.Timean=n()}(global,(function(){return(()=>{"use strict";var e={913:(e,n)=>{Object.defineProperty(n,"__esModule",{value:!0}),n.defaultConfig=void 0,n.defaultConfig={current:"just now",replacer:"%d",past:{day:{singular:"%d day ago",plural:"%d days ago"},hour:{singular:"%d hour ago",plural:"%d hours ago"},minute:{singular:"%d minute ago",plural:"%d minutes ago"},month:{singular:"%d month ago",plural:"%d months ago"},second:{singular:"%d second ago",plural:"%d seconds ago"},year:{singular:"%d year ago",plural:"%d years ago"}},future:{day:{singular:"in %d day",plural:"in %d days"},hour:{singular:"in %d hour",plural:"in %d hours"},minute:{singular:"in %d minute",plural:"in %d minutes"},month:{singular:"in %d month",plural:"in %d months"},second:{singular:"in %d second",plural:"in %d seconds"},year:{singular:"in %d year",plural:"in %d years"}}}},607:(e,n,r)=>{var t=r(593),a=function(){function e(e){this.config=e}return e.prototype.from=function(e,n,r){return(0,t.calculateDiff)(e,n,r||this.config)},e.prototype.fromNow=function(e,n){return(0,t.calculateDiff)(new Date,e,n||this.config)},e}();e.exports={create:function(e){return new a(e)},from:function(e,n,r){return(0,t.calculateDiff)(e,n,r)},fromNow:function(e,n){return(0,t.calculateDiff)(new Date,e,n)}}},593:function(e,n,r){var t=this&&this.__assign||function(){return t=Object.assign||function(e){for(var n,r=1,t=arguments.length;r<t;r++)for(var a in n=arguments[r])Object.prototype.hasOwnProperty.call(n,a)&&(e[a]=n[a]);return e},t.apply(this,arguments)};Object.defineProperty(n,"__esModule",{value:!0}),n.getUnitString=n.calculateDiff=n.Tense=void 0;var a,u=r(913);function o(e,n,r,t){if(r===a.PRESENT)return(""+t.current).replace(t.replacer,e.toString());if(r===a.PAST&&t.past){if("string"==typeof t.past[n])return(""+t.past[n]).replace(t.replacer,e.toString());var u=t.past[n],o=u.singular,i=u.plural;return(""+(1===e?o:i)).replace(t.replacer,e.toString())}if(r===a.FUTURE&&t.future){if("string"==typeof t.future[n])return(""+t.future[n]).replace(t.replacer,e.toString());var l=t.future[n];return o=l.singular,i=l.plural,(""+(1===e?o:i)).replace(t.replacer,e.toString())}}!function(e){e[e.PAST=0]="PAST",e[e.PRESENT=1]="PRESENT",e[e.FUTURE=2]="FUTURE"}(a=n.Tense||(n.Tense={})),n.calculateDiff=function(e,n,r){var i=n.getTime()-e.getTime(),l=0===i?a.PRESENT:i<0?a.PAST:a.FUTURE,s=Math.floor(Math.abs(i)/1e3),c=t(t({},u.defaultConfig),r),f=[{unit:"year",valueInSeconds:31536e3},{unit:"month",valueInSeconds:2592e3},{unit:"day",valueInSeconds:86400},{unit:"hour",valueInSeconds:3600},{unit:"minute",valueInSeconds:60},{unit:"second",valueInSeconds:1}].find((function(e){return Math.floor(s/e.valueInSeconds)>=1}));return o(Math.floor(s/((null==f?void 0:f.valueInSeconds)||1)),(null==f?void 0:f.unit)||"second",l,c)},n.getUnitString=o}},n={};return function r(t){var a=n[t];if(void 0!==a)return a.exports;var u=n[t]={exports:{}};return e[t].call(u.exports,u,u.exports,r),u.exports}(607)})()}));