You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.4 KiB
65 lines
2.4 KiB
!(function (e, t) {
|
|
if ('object' == typeof exports && 'undefined' != typeof module) {
|
|
module.exports = t();
|
|
} else {
|
|
if ('function' == typeof define && define.amd) {
|
|
define(t);
|
|
} else {
|
|
(e = 'undefined' != typeof globalThis ? globalThis : e || self).dayjs_plugin_advancedFormat = t();
|
|
}
|
|
}
|
|
})(this, function () {
|
|
'use strict';
|
|
|
|
return function (e, t, r) {
|
|
var n = t.prototype;
|
|
var s = n.format;
|
|
r.en.ordinal = function (e) {
|
|
var t = ['th', 'st', 'nd', 'rd'];
|
|
var r = e % 100;
|
|
return '[' + e + (t[(r - 20) % 10] || t[r] || t[0]) + ']';
|
|
};
|
|
n.format = function (e) {
|
|
var that = this;
|
|
var r = this.$locale();
|
|
if (!this.isValid()) {
|
|
return s.bind(this)(e);
|
|
}
|
|
var n = this.$utils();
|
|
var a = (e || 'YYYY-MM-DDTHH:mm:ssZ').replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function (e) {
|
|
switch (e) {
|
|
case 'Q':
|
|
return Math.ceil((that.$M + 1) / 3);
|
|
case 'Do':
|
|
return r.ordinal(that.$D);
|
|
case 'gggg':
|
|
return that.weekYear();
|
|
case 'GGGG':
|
|
return that.isoWeekYear();
|
|
case 'wo':
|
|
return r.ordinal(that.week(), 'W');
|
|
case 'w':
|
|
case 'ww':
|
|
return n.s(that.week(), 'w' === e ? 1 : 2, '0');
|
|
case 'W':
|
|
case 'WW':
|
|
return n.s(that.isoWeek(), 'W' === e ? 1 : 2, '0');
|
|
case 'k':
|
|
case 'kk':
|
|
return n.s(String(0 === that.$H ? 24 : that.$H), 'k' === e ? 1 : 2, '0');
|
|
case 'X':
|
|
return Math.floor(that.$d.getTime() / 1000);
|
|
case 'x':
|
|
return that.$d.getTime();
|
|
case 'z':
|
|
return '[' + that.offsetName() + ']';
|
|
case 'zzz':
|
|
return '[' + that.offsetName('long') + ']';
|
|
default:
|
|
return e;
|
|
}
|
|
});
|
|
return s.bind(this)(a);
|
|
};
|
|
};
|
|
});
|
|
|