UNPKG

dayjs

Version:

2KB immutable date time library alternative to Moment.js with the same modern API

2 lines (1 loc) 991 B
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.dayjs_plugin_utc=e()}(this,function(){"use strict";return function(t,e,i){var n=e.prototype;i.utc=function(t,i){return new e({date:t,utc:!0,format:i})},n.utc=function(){return i(this.toDate(),{locale:this.$L,utc:!0})},n.local=function(){return i(this.toDate(),{locale:this.$L,utc:!1})};var s=n.parse;n.parse=function(t){t.utc&&(this.$u=!0),s.call(this,t)};var u=n.init;n.init=function(){if(this.$u){var t=this.$d;this.$y=t.getUTCFullYear(),this.$M=t.getUTCMonth(),this.$D=t.getUTCDate(),this.$W=t.getUTCDay(),this.$H=t.getUTCHours(),this.$m=t.getUTCMinutes(),this.$s=t.getUTCSeconds(),this.$ms=t.getUTCMilliseconds()}else u.call(this)};var o=n.utcOffset;n.utcOffset=function(){return this.$u?0:o.call(this)};var c=n.format;n.format=function(t){var e=t||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return c.call(this,e)},n.isUTC=function(){return!!this.$u}}});