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.
44 lines
1.4 KiB
44 lines
1.4 KiB
1 year ago
|
!(function (t, n) {
|
||
|
if ('object' == typeof exports && 'undefined' != typeof module) {
|
||
|
module.exports = n();
|
||
|
} else {
|
||
|
if ('function' == typeof define && define.amd) {
|
||
|
define(n);
|
||
|
} else {
|
||
|
(t = 'undefined' != typeof globalThis ? globalThis : t || self).dayjs_plugin_quarterOfYear = n();
|
||
|
}
|
||
|
}
|
||
|
})(this, function () {
|
||
|
'use strict';
|
||
|
|
||
|
var t = 'month';
|
||
|
var n = 'quarter';
|
||
|
return function (e, i) {
|
||
|
var r = i.prototype;
|
||
|
r.quarter = function (t) {
|
||
|
return this.$utils().u(t) ? Math.ceil((this.month() + 1) / 3) : this.month((this.month() % 3) + 3 * (t - 1));
|
||
|
};
|
||
|
var s = r.add;
|
||
|
r.add = function (e, i) {
|
||
|
e = Number(e);
|
||
|
return this.$utils().p(i) === n ? this.add(3 * e, t) : s.bind(this)(e, i);
|
||
|
};
|
||
|
var u = r.startOf;
|
||
|
r.startOf = function (e, i) {
|
||
|
var r = this.$utils();
|
||
|
var s = !!r.u(i) || i;
|
||
|
if (r.p(e) === n) {
|
||
|
var o = this.quarter() - 1;
|
||
|
return s
|
||
|
? this.month(3 * o)
|
||
|
.startOf(t)
|
||
|
.startOf('day')
|
||
|
: this.month(3 * o + 2)
|
||
|
.endOf(t)
|
||
|
.endOf('day');
|
||
|
}
|
||
|
return u.bind(this)(e, i);
|
||
|
};
|
||
|
};
|
||
|
});
|