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
!(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_weekOfYear = t();
|
|
}
|
|
}
|
|
})(this, function () {
|
|
'use strict';
|
|
|
|
var e = 'week';
|
|
var t = 'year';
|
|
return function (i, n, r) {
|
|
var f = n.prototype;
|
|
f.week = function (i) {
|
|
if (void 0 === i) {
|
|
i = null;
|
|
}
|
|
if (null !== i) {
|
|
return this.add(7 * (i - this.week()), 'day');
|
|
}
|
|
var n = this.$locale().yearStart || 1;
|
|
if (11 === this.month() && this.date() > 25) {
|
|
var f = r(this).startOf(t).add(1, t).date(n);
|
|
var s = r(this).endOf(e);
|
|
if (f.isBefore(s)) {
|
|
return 1;
|
|
}
|
|
}
|
|
var a = r(this).startOf(t).date(n).startOf(e).subtract(1, 'millisecond');
|
|
var o = this.diff(a, e, true);
|
|
return o < 0 ? r(this).startOf('week').week() : Math.ceil(o);
|
|
};
|
|
f.weeks = function (e) {
|
|
if (void 0 === e) {
|
|
e = null;
|
|
}
|
|
return this.week(e);
|
|
};
|
|
};
|
|
});
|
|
|