dayjs-ext
Version:
2KB immutable date time library alternative to Moment.js with the same modern API
3 lines (2 loc) • 798 B
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs_plugin_advancedFormat=e()}(this,function(){"use strict";return function(t,e,n){var r=e.prototype,o=r.format;n.en.ordinal=function(t){var e=["th","st","nd","rd"],n=t%100;return"["+t+(e[(n-20)%10]||e[n]||e[0])+"]"},r.format=function(t){var e=this,n=this.$locale(),r=this.$utils(),i=(t||"YYYY-MM-DDTHH:mm:ssZ").replace(/Q|Do|X|x|k{1,2}|S/g,function(t){switch(t){case"Q":return Math.ceil((e.$M+1)/3);case"Do":return n.ordinal(e.$D);case"k":case"kk":return r.padStart(String(0===e.$H?24:e.$H),"k"===t?1:2,"0");case"X":return Math.floor(e.$d.getTime()/1e3);default:return e.$d.getTime()}});return o.bind(this)(i)}}});
//# sourceMappingURL=advancedFormat.js.map