UNPKG

1.39 kBJavaScriptView Raw
1export default (function (o, c) {
2 // locale needed later
3 var proto = c.prototype;
4
5 proto.$g = function (input, get, set) {
6 if (this.$utils().u(input)) return this[get];
7 return this.$set(set, input);
8 };
9
10 proto.set = function (string, _int) {
11 return this.$set(string, _int);
12 };
13
14 var oldStartOf = proto.startOf;
15
16 proto.startOf = function (units, startOf) {
17 this.$d = oldStartOf.bind(this)(units, startOf).toDate();
18 this.init();
19 return this;
20 };
21
22 var oldAdd = proto.add;
23
24 proto.add = function (number, units) {
25 this.$d = oldAdd.bind(this)(number, units).toDate();
26 this.init();
27 return this;
28 };
29
30 var oldLocale = proto.locale;
31
32 proto.locale = function (preset, object) {
33 if (!preset) return this.$L;
34 this.$L = oldLocale.bind(this)(preset, object).$L;
35 return this;
36 };
37
38 var oldDaysInMonth = proto.daysInMonth;
39
40 proto.daysInMonth = function () {
41 return oldDaysInMonth.bind(this.clone())();
42 };
43
44 var oldIsSame = proto.isSame;
45
46 proto.isSame = function (that, units) {
47 return oldIsSame.bind(this.clone())(that, units);
48 };
49
50 var oldIsBefore = proto.isBefore;
51
52 proto.isBefore = function (that, units) {
53 return oldIsBefore.bind(this.clone())(that, units);
54 };
55
56 var oldIsAfter = proto.isAfter;
57
58 proto.isAfter = function (that, units) {
59 return oldIsAfter.bind(this.clone())(that, units);
60 };
61});
\No newline at end of file