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.
80 lines
2.6 KiB
80 lines
2.6 KiB
!(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_objectSupport = n();
|
|
}
|
|
}
|
|
})(this, function () {
|
|
'use strict';
|
|
|
|
return function (t, n, e) {
|
|
var i = n.prototype;
|
|
var r = function (t) {
|
|
var n;
|
|
var r = t.date;
|
|
var o = t.utc;
|
|
var a = {};
|
|
if (!((n = r) instanceof Date) && !(n instanceof Array) && n instanceof Object) {
|
|
if (!Object.keys(r).length) {
|
|
return new Date();
|
|
}
|
|
var u = o ? e.utc() : e();
|
|
Object.keys(r).forEach(function (t) {
|
|
var n;
|
|
var e;
|
|
a[((n = t), (e = i.$utils().p(n)), 'date' === e ? 'day' : e)] = r[t];
|
|
});
|
|
var d = a.day || (a.year || a.month >= 0 ? 1 : u.date());
|
|
var c = a.year || u.year();
|
|
var f = a.month >= 0 ? a.month : a.year || a.day ? 0 : u.month();
|
|
var s = a.hour || 0;
|
|
var h = a.minute || 0;
|
|
var b = a.second || 0;
|
|
var y = a.millisecond || 0;
|
|
return o ? new Date(Date.UTC(c, f, d, s, h, b, y)) : new Date(c, f, d, s, h, b, y);
|
|
}
|
|
return r;
|
|
};
|
|
var o = i.parse;
|
|
i.parse = function (t) {
|
|
t.date = r.bind(this)(t);
|
|
o.bind(this)(t);
|
|
};
|
|
var a = i.set;
|
|
var u = i.add;
|
|
var d = function (t, n, e, i) {
|
|
if (void 0 === i) {
|
|
i = 1;
|
|
}
|
|
if (n instanceof Object) {
|
|
var r = Object.keys(n);
|
|
var that = this;
|
|
r.forEach(function (e) {
|
|
that = t.bind(that)(n[e] * i, e);
|
|
});
|
|
return that;
|
|
}
|
|
return t.bind(this)(n * i, e);
|
|
};
|
|
i.set = function (t, n) {
|
|
n = void 0 === n ? t : n;
|
|
return d.bind(this)(
|
|
function (t, n) {
|
|
return a.bind(this)(n, t);
|
|
},
|
|
n,
|
|
t
|
|
);
|
|
};
|
|
i.add = function (t, n) {
|
|
return d.bind(this)(u, t, n);
|
|
};
|
|
i.subtract = function (t, n) {
|
|
return d.bind(this)(u, t, n, -1);
|
|
};
|
|
};
|
|
});
|
|
|