@nocobase/plugin-backup-restore 2.2.20 → 2.2.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/externalVersion.js +5 -5
- package/dist/node_modules/@hapi/topo/package.json +1 -1
- package/dist/node_modules/@xhmikosr/decompress/package.json +1 -1
- package/dist/node_modules/archiver/package.json +1 -1
- package/dist/node_modules/fs-extra/package.json +1 -1
- package/dist/node_modules/moment/LICENSE +1 -1
- package/dist/node_modules/moment/dist/locale/am-et.js +62 -0
- package/dist/node_modules/moment/dist/locale/ar-dz.js +8 -8
- package/dist/node_modules/moment/dist/locale/ar-ly.js +8 -8
- package/dist/node_modules/moment/dist/locale/ar-ps.js +112 -0
- package/dist/node_modules/moment/dist/locale/ar.js +8 -8
- package/dist/node_modules/moment/dist/locale/be.js +2 -2
- package/dist/node_modules/moment/dist/locale/bs.js +14 -4
- package/dist/node_modules/moment/dist/locale/ca.js +7 -7
- package/dist/node_modules/moment/dist/locale/cs.js +5 -4
- package/dist/node_modules/moment/dist/locale/cv.js +2 -2
- package/dist/node_modules/moment/dist/locale/de-at.js +29 -1
- package/dist/node_modules/moment/dist/locale/de-ch.js +29 -1
- package/dist/node_modules/moment/dist/locale/de.js +29 -1
- package/dist/node_modules/moment/dist/locale/en-au.js +6 -6
- package/dist/node_modules/moment/dist/locale/en-ca.js +6 -6
- package/dist/node_modules/moment/dist/locale/en-gb.js +6 -6
- package/dist/node_modules/moment/dist/locale/en-ie.js +6 -6
- package/dist/node_modules/moment/dist/locale/en-il.js +6 -6
- package/dist/node_modules/moment/dist/locale/en-in.js +6 -6
- package/dist/node_modules/moment/dist/locale/en-nz.js +6 -6
- package/dist/node_modules/moment/dist/locale/en-sg.js +6 -6
- package/dist/node_modules/moment/dist/locale/hu.js +3 -3
- package/dist/node_modules/moment/dist/locale/id.js +12 -1
- package/dist/node_modules/moment/dist/locale/it.js +4 -4
- package/dist/node_modules/moment/dist/locale/ka.js +1 -1
- package/dist/node_modules/moment/dist/locale/ku-kmr.js +121 -0
- package/dist/node_modules/moment/dist/locale/lt.js +2 -2
- package/dist/node_modules/moment/dist/locale/me.js +2 -2
- package/dist/node_modules/moment/dist/locale/nb.js +4 -4
- package/dist/node_modules/moment/dist/locale/nl-be.js +2 -2
- package/dist/node_modules/moment/dist/locale/nl.js +1 -1
- package/dist/node_modules/moment/dist/locale/oc-lnc.js +6 -6
- package/dist/node_modules/moment/dist/locale/pl.js +1 -1
- package/dist/node_modules/moment/dist/locale/ps.js +177 -0
- package/dist/node_modules/moment/dist/locale/pt-br.js +14 -6
- package/dist/node_modules/moment/dist/locale/ru.js +2 -2
- package/dist/node_modules/moment/dist/locale/sv.js +7 -7
- package/dist/node_modules/moment/dist/locale/sw.js +56 -14
- package/dist/node_modules/moment/dist/locale/tet.js +6 -6
- package/dist/node_modules/moment/dist/locale/tlh.js +8 -8
- package/dist/node_modules/moment/dist/locale/tzl.js +2 -2
- package/dist/node_modules/moment/dist/locale/uk.js +9 -8
- package/dist/node_modules/moment/dist/locale/uz-latn.js +1 -1
- package/dist/node_modules/moment/dist/locale/uz.js +1 -1
- package/dist/node_modules/moment/dist/locale/x-pseudo.js +6 -6
- package/dist/node_modules/moment/dist/moment.js +1274 -1042
- package/dist/node_modules/moment/dojo.profile.js +11 -0
- package/dist/node_modules/moment/ender.js +1 -1
- package/dist/node_modules/moment/locale/am-et.js +73 -0
- package/dist/node_modules/moment/locale/ar-dz.js +8 -8
- package/dist/node_modules/moment/locale/ar-ly.js +8 -8
- package/dist/node_modules/moment/locale/ar-ps.js +123 -0
- package/dist/node_modules/moment/locale/ar.js +8 -8
- package/dist/node_modules/moment/locale/be.js +2 -2
- package/dist/node_modules/moment/locale/bm.js +2 -0
- package/dist/node_modules/moment/locale/bs.js +14 -4
- package/dist/node_modules/moment/locale/ca.js +7 -7
- package/dist/node_modules/moment/locale/cs.js +5 -4
- package/dist/node_modules/moment/locale/cv.js +2 -2
- package/dist/node_modules/moment/locale/de-at.js +29 -1
- package/dist/node_modules/moment/locale/de-ch.js +29 -1
- package/dist/node_modules/moment/locale/de.js +29 -1
- package/dist/node_modules/moment/locale/en-au.js +6 -6
- package/dist/node_modules/moment/locale/en-ca.js +6 -6
- package/dist/node_modules/moment/locale/en-gb.js +6 -6
- package/dist/node_modules/moment/locale/en-ie.js +6 -6
- package/dist/node_modules/moment/locale/en-il.js +6 -6
- package/dist/node_modules/moment/locale/en-in.js +6 -6
- package/dist/node_modules/moment/locale/en-nz.js +6 -6
- package/dist/node_modules/moment/locale/en-sg.js +6 -6
- package/dist/node_modules/moment/locale/hu.js +3 -3
- package/dist/node_modules/moment/locale/id.js +12 -1
- package/dist/node_modules/moment/locale/it.js +4 -4
- package/dist/node_modules/moment/locale/ka.js +1 -1
- package/dist/node_modules/moment/locale/ku-kmr.js +125 -0
- package/dist/node_modules/moment/locale/lt.js +2 -2
- package/dist/node_modules/moment/locale/me.js +2 -2
- package/dist/node_modules/moment/locale/mk.js +0 -1
- package/dist/node_modules/moment/locale/nb.js +4 -4
- package/dist/node_modules/moment/locale/nl-be.js +2 -2
- package/dist/node_modules/moment/locale/nl.js +1 -1
- package/dist/node_modules/moment/locale/oc-lnc.js +6 -6
- package/dist/node_modules/moment/locale/pl.js +1 -1
- package/dist/node_modules/moment/locale/ps.js +188 -0
- package/dist/node_modules/moment/locale/pt-br.js +14 -6
- package/dist/node_modules/moment/locale/ru.js +2 -2
- package/dist/node_modules/moment/locale/sv.js +7 -7
- package/dist/node_modules/moment/locale/sw.js +56 -14
- package/dist/node_modules/moment/locale/tet.js +6 -6
- package/dist/node_modules/moment/locale/tlh.js +8 -8
- package/dist/node_modules/moment/locale/tzl.js +2 -2
- package/dist/node_modules/moment/locale/uk.js +9 -8
- package/dist/node_modules/moment/locale/uz-latn.js +1 -1
- package/dist/node_modules/moment/locale/uz.js +1 -1
- package/dist/node_modules/moment/locale/x-pseudo.js +6 -6
- package/dist/node_modules/moment/min/locales.js +1380 -771
- package/dist/node_modules/moment/min/locales.min.js +211 -1
- package/dist/node_modules/moment/min/moment-with-locales.js +2705 -1858
- package/dist/node_modules/moment/min/moment-with-locales.min.js +216 -1
- package/dist/node_modules/moment/min/moment.min.js +8 -1
- package/dist/node_modules/moment/moment.d.ts +2 -0
- package/dist/node_modules/moment/moment.js +3 -3
- package/dist/node_modules/moment/package.json +1 -1
- package/dist/node_modules/moment/src/lib/create/check-overflow.js +15 -15
- package/dist/node_modules/moment/src/lib/create/from-array.js +77 -10
- package/dist/node_modules/moment/src/lib/create/from-string-and-array.js +2 -0
- package/dist/node_modules/moment/src/lib/create/parsing-flags.js +1 -0
- package/dist/node_modules/moment/src/lib/create/valid.js +25 -24
- package/dist/node_modules/moment/src/lib/duration/as.js +3 -15
- package/dist/node_modules/moment/src/lib/duration/bubble.js +4 -6
- package/dist/node_modules/moment/src/lib/duration/humanize.js +14 -3
- package/dist/node_modules/moment/src/lib/format/format.js +7 -4
- package/dist/node_modules/moment/src/lib/locale/en.js +6 -6
- package/dist/node_modules/moment/src/lib/locale/formats.js +19 -3
- package/dist/node_modules/moment/src/lib/locale/locales.js +33 -13
- package/dist/node_modules/moment/src/lib/locale/relative.js +25 -2
- package/dist/node_modules/moment/src/lib/locale/set.js +4 -0
- package/dist/node_modules/moment/src/lib/moment/calendar.js +10 -10
- package/dist/node_modules/moment/src/lib/moment/get-set.js +66 -22
- package/dist/node_modules/moment/src/lib/moment/min-max.js +15 -3
- package/dist/node_modules/moment/src/lib/parse/regex.js +4 -0
- package/dist/node_modules/moment/src/lib/units/aliases.js +50 -6
- package/dist/node_modules/moment/src/lib/units/day-of-month.js +7 -11
- package/dist/node_modules/moment/src/lib/units/day-of-week.js +52 -21
- package/dist/node_modules/moment/src/lib/units/day-of-year.js +0 -9
- package/dist/node_modules/moment/src/lib/units/era.js +13 -7
- package/dist/node_modules/moment/src/lib/units/hour.js +5 -12
- package/dist/node_modules/moment/src/lib/units/millisecond.js +0 -10
- package/dist/node_modules/moment/src/lib/units/minute.js +7 -12
- package/dist/node_modules/moment/src/lib/units/month.js +38 -28
- package/dist/node_modules/moment/src/lib/units/offset.js +13 -1
- package/dist/node_modules/moment/src/lib/units/priorities.js +18 -5
- package/dist/node_modules/moment/src/lib/units/quarter.js +0 -10
- package/dist/node_modules/moment/src/lib/units/second.js +7 -12
- package/dist/node_modules/moment/src/lib/units/week-calendar-utils.js +22 -8
- package/dist/node_modules/moment/src/lib/units/week-year.js +1 -11
- package/dist/node_modules/moment/src/lib/units/week.js +8 -15
- package/dist/node_modules/moment/src/lib/units/year.js +0 -10
- package/dist/node_modules/moment/src/lib/utils/deprecate.js +1 -1
- package/dist/node_modules/moment/src/locale/am-et.js +62 -0
- package/dist/node_modules/moment/src/locale/ar-dz.js +8 -8
- package/dist/node_modules/moment/src/locale/ar-ly.js +8 -8
- package/dist/node_modules/moment/src/locale/ar-ps.js +112 -0
- package/dist/node_modules/moment/src/locale/ar.js +8 -8
- package/dist/node_modules/moment/src/locale/be.js +2 -2
- package/dist/node_modules/moment/src/locale/bs.js +14 -4
- package/dist/node_modules/moment/src/locale/ca.js +7 -7
- package/dist/node_modules/moment/src/locale/cs.js +5 -4
- package/dist/node_modules/moment/src/locale/cv.js +2 -2
- package/dist/node_modules/moment/src/locale/de-at.js +29 -1
- package/dist/node_modules/moment/src/locale/de-ch.js +29 -1
- package/dist/node_modules/moment/src/locale/de.js +29 -1
- package/dist/node_modules/moment/src/locale/en-au.js +6 -6
- package/dist/node_modules/moment/src/locale/en-ca.js +6 -6
- package/dist/node_modules/moment/src/locale/en-gb.js +6 -6
- package/dist/node_modules/moment/src/locale/en-ie.js +6 -6
- package/dist/node_modules/moment/src/locale/en-il.js +6 -6
- package/dist/node_modules/moment/src/locale/en-in.js +6 -6
- package/dist/node_modules/moment/src/locale/en-nz.js +6 -6
- package/dist/node_modules/moment/src/locale/en-sg.js +6 -6
- package/dist/node_modules/moment/src/locale/hu.js +3 -3
- package/dist/node_modules/moment/src/locale/id.js +12 -1
- package/dist/node_modules/moment/src/locale/it.js +4 -4
- package/dist/node_modules/moment/src/locale/ka.js +1 -1
- package/dist/node_modules/moment/src/locale/ku-kmr.js +121 -0
- package/dist/node_modules/moment/src/locale/lt.js +2 -2
- package/dist/node_modules/moment/src/locale/me.js +2 -2
- package/dist/node_modules/moment/src/locale/nb.js +4 -4
- package/dist/node_modules/moment/src/locale/nl-be.js +2 -2
- package/dist/node_modules/moment/src/locale/nl.js +1 -1
- package/dist/node_modules/moment/src/locale/oc-lnc.js +6 -6
- package/dist/node_modules/moment/src/locale/pl.js +1 -1
- package/dist/node_modules/moment/src/locale/ps.js +177 -0
- package/dist/node_modules/moment/src/locale/pt-br.js +14 -6
- package/dist/node_modules/moment/src/locale/ru.js +2 -2
- package/dist/node_modules/moment/src/locale/sv.js +7 -7
- package/dist/node_modules/moment/src/locale/sw.js +56 -14
- package/dist/node_modules/moment/src/locale/tet.js +6 -6
- package/dist/node_modules/moment/src/locale/tlh.js +8 -8
- package/dist/node_modules/moment/src/locale/tzl.js +2 -2
- package/dist/node_modules/moment/src/locale/uk.js +9 -8
- package/dist/node_modules/moment/src/locale/uz-latn.js +1 -1
- package/dist/node_modules/moment/src/locale/uz.js +1 -1
- package/dist/node_modules/moment/src/locale/x-pseudo.js +6 -6
- package/dist/node_modules/moment/src/moment.js +2 -2
- package/dist/node_modules/moment/ts3.1-typings/moment.d.ts +258 -78
- package/dist/node_modules/semver/package.json +1 -1
- package/package.json +2 -2
- package/dist/node_modules/moment/package.js +0 -11
|
@@ -2,9 +2,7 @@ import { normalizeUnits, normalizeObjectUnits } from '../units/aliases';
|
|
|
2
2
|
import { getPrioritizedUnits } from '../units/priorities';
|
|
3
3
|
import { hooks } from '../utils/hooks';
|
|
4
4
|
import isFunction from '../utils/is-function';
|
|
5
|
-
import {
|
|
6
|
-
import { isLeapYear } from '../utils/is-leap-year';
|
|
7
|
-
import toInt from '../utils/to-int';
|
|
5
|
+
import { isLeapYear } from '../units/year';
|
|
8
6
|
|
|
9
7
|
export function makeGetSet(unit, keepTime) {
|
|
10
8
|
return function (value) {
|
|
@@ -19,29 +17,75 @@ export function makeGetSet(unit, keepTime) {
|
|
|
19
17
|
}
|
|
20
18
|
|
|
21
19
|
export function get(mom, unit) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
if (!mom.isValid()) {
|
|
21
|
+
return NaN;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
var d = mom._d,
|
|
25
|
+
isUTC = mom._isUTC;
|
|
26
|
+
|
|
27
|
+
switch (unit) {
|
|
28
|
+
case 'Milliseconds':
|
|
29
|
+
return isUTC ? d.getUTCMilliseconds() : d.getMilliseconds();
|
|
30
|
+
case 'Seconds':
|
|
31
|
+
return isUTC ? d.getUTCSeconds() : d.getSeconds();
|
|
32
|
+
case 'Minutes':
|
|
33
|
+
return isUTC ? d.getUTCMinutes() : d.getMinutes();
|
|
34
|
+
case 'Hours':
|
|
35
|
+
return isUTC ? d.getUTCHours() : d.getHours();
|
|
36
|
+
case 'Date':
|
|
37
|
+
return isUTC ? d.getUTCDate() : d.getDate();
|
|
38
|
+
case 'Day':
|
|
39
|
+
return isUTC ? d.getUTCDay() : d.getDay();
|
|
40
|
+
case 'Month':
|
|
41
|
+
return isUTC ? d.getUTCMonth() : d.getMonth();
|
|
42
|
+
case 'FullYear':
|
|
43
|
+
return isUTC ? d.getUTCFullYear() : d.getFullYear();
|
|
44
|
+
default:
|
|
45
|
+
return NaN; // Just in case
|
|
46
|
+
}
|
|
25
47
|
}
|
|
26
48
|
|
|
27
49
|
export function set(mom, unit, value) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
mom.month() === 1 &&
|
|
33
|
-
mom.date() === 29
|
|
34
|
-
) {
|
|
35
|
-
value = toInt(value);
|
|
36
|
-
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
|
|
37
|
-
value,
|
|
38
|
-
mom.month(),
|
|
39
|
-
daysInMonth(value, mom.month())
|
|
40
|
-
);
|
|
41
|
-
} else {
|
|
42
|
-
mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
|
|
43
|
-
}
|
|
50
|
+
var d, isUTC, year, month, date;
|
|
51
|
+
|
|
52
|
+
if (!mom.isValid() || isNaN(value)) {
|
|
53
|
+
return;
|
|
44
54
|
}
|
|
55
|
+
|
|
56
|
+
d = mom._d;
|
|
57
|
+
isUTC = mom._isUTC;
|
|
58
|
+
|
|
59
|
+
switch (unit) {
|
|
60
|
+
case 'Milliseconds':
|
|
61
|
+
return void (isUTC
|
|
62
|
+
? d.setUTCMilliseconds(value)
|
|
63
|
+
: d.setMilliseconds(value));
|
|
64
|
+
case 'Seconds':
|
|
65
|
+
return void (isUTC ? d.setUTCSeconds(value) : d.setSeconds(value));
|
|
66
|
+
case 'Minutes':
|
|
67
|
+
return void (isUTC ? d.setUTCMinutes(value) : d.setMinutes(value));
|
|
68
|
+
case 'Hours':
|
|
69
|
+
return void (isUTC ? d.setUTCHours(value) : d.setHours(value));
|
|
70
|
+
case 'Date':
|
|
71
|
+
return void (isUTC ? d.setUTCDate(value) : d.setDate(value));
|
|
72
|
+
// case 'Day': // Not real
|
|
73
|
+
// return void (isUTC ? d.setUTCDay(value) : d.setDay(value));
|
|
74
|
+
// case 'Month': // Not used because we need to pass two variables
|
|
75
|
+
// return void (isUTC ? d.setUTCMonth(value) : d.setMonth(value));
|
|
76
|
+
case 'FullYear':
|
|
77
|
+
break; // See below ...
|
|
78
|
+
default:
|
|
79
|
+
return; // Just in case
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
year = value;
|
|
83
|
+
month = mom.month();
|
|
84
|
+
date = mom.date();
|
|
85
|
+
date = date === 29 && month === 1 && !isLeapYear(year) ? 28 : date;
|
|
86
|
+
void (isUTC
|
|
87
|
+
? d.setUTCFullYear(year, month, date)
|
|
88
|
+
: d.setFullYear(year, month, date));
|
|
45
89
|
}
|
|
46
90
|
|
|
47
91
|
// MOMENTS
|
|
@@ -2,6 +2,7 @@ import { deprecate } from '../utils/deprecate';
|
|
|
2
2
|
import isArray from '../utils/is-array';
|
|
3
3
|
import { createLocal } from '../create/local';
|
|
4
4
|
import { createInvalid } from '../create/valid';
|
|
5
|
+
import { isMoment } from './constructor';
|
|
5
6
|
|
|
6
7
|
export var prototypeMin = deprecate(
|
|
7
8
|
'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
|
|
@@ -39,9 +40,20 @@ function pickBy(fn, moments) {
|
|
|
39
40
|
if (!moments.length) {
|
|
40
41
|
return createLocal();
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
for (i = 0; i < moments.length; ++i) {
|
|
44
|
+
if (isMoment(moments[i])) {
|
|
45
|
+
res = moments[i];
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (!res) {
|
|
50
|
+
return createInvalid();
|
|
51
|
+
}
|
|
52
|
+
for (++i; i < moments.length; ++i) {
|
|
53
|
+
if (
|
|
54
|
+
isMoment(moments[i]) &&
|
|
55
|
+
(!moments[i].isValid() || moments[i][fn](res))
|
|
56
|
+
) {
|
|
45
57
|
res = moments[i];
|
|
46
58
|
}
|
|
47
59
|
}
|
|
@@ -18,6 +18,8 @@ var match1 = /\d/, // 0 - 9
|
|
|
18
18
|
// includes scottish gaelic two word and hyphenated months
|
|
19
19
|
matchWord =
|
|
20
20
|
/[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
|
|
21
|
+
match1to2NoLeadingZero = /^[1-9]\d?/, // 1-99
|
|
22
|
+
match1to2HasZero = /^([1-9]\d|\d)/, // 0-99
|
|
21
23
|
regexes;
|
|
22
24
|
|
|
23
25
|
export {
|
|
@@ -38,6 +40,8 @@ export {
|
|
|
38
40
|
matchShortOffset,
|
|
39
41
|
matchTimestamp,
|
|
40
42
|
matchWord,
|
|
43
|
+
match1to2NoLeadingZero,
|
|
44
|
+
match1to2HasZero,
|
|
41
45
|
};
|
|
42
46
|
|
|
43
47
|
import hasOwnProp from '../utils/has-own-prop';
|
|
@@ -1,11 +1,55 @@
|
|
|
1
1
|
import hasOwnProp from '../utils/has-own-prop';
|
|
2
2
|
|
|
3
|
-
var aliases = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
3
|
+
var aliases = {
|
|
4
|
+
D: 'date',
|
|
5
|
+
dates: 'date',
|
|
6
|
+
date: 'date',
|
|
7
|
+
d: 'day',
|
|
8
|
+
days: 'day',
|
|
9
|
+
day: 'day',
|
|
10
|
+
e: 'weekday',
|
|
11
|
+
weekdays: 'weekday',
|
|
12
|
+
weekday: 'weekday',
|
|
13
|
+
E: 'isoWeekday',
|
|
14
|
+
isoweekdays: 'isoWeekday',
|
|
15
|
+
isoweekday: 'isoWeekday',
|
|
16
|
+
DDD: 'dayOfYear',
|
|
17
|
+
dayofyears: 'dayOfYear',
|
|
18
|
+
dayofyear: 'dayOfYear',
|
|
19
|
+
h: 'hour',
|
|
20
|
+
hours: 'hour',
|
|
21
|
+
hour: 'hour',
|
|
22
|
+
ms: 'millisecond',
|
|
23
|
+
milliseconds: 'millisecond',
|
|
24
|
+
millisecond: 'millisecond',
|
|
25
|
+
m: 'minute',
|
|
26
|
+
minutes: 'minute',
|
|
27
|
+
minute: 'minute',
|
|
28
|
+
M: 'month',
|
|
29
|
+
months: 'month',
|
|
30
|
+
month: 'month',
|
|
31
|
+
Q: 'quarter',
|
|
32
|
+
quarters: 'quarter',
|
|
33
|
+
quarter: 'quarter',
|
|
34
|
+
s: 'second',
|
|
35
|
+
seconds: 'second',
|
|
36
|
+
second: 'second',
|
|
37
|
+
gg: 'weekYear',
|
|
38
|
+
weekyears: 'weekYear',
|
|
39
|
+
weekyear: 'weekYear',
|
|
40
|
+
GG: 'isoWeekYear',
|
|
41
|
+
isoweekyears: 'isoWeekYear',
|
|
42
|
+
isoweekyear: 'isoWeekYear',
|
|
43
|
+
w: 'week',
|
|
44
|
+
weeks: 'week',
|
|
45
|
+
week: 'week',
|
|
46
|
+
W: 'isoWeek',
|
|
47
|
+
isoweeks: 'isoWeek',
|
|
48
|
+
isoweek: 'isoWeek',
|
|
49
|
+
y: 'year',
|
|
50
|
+
years: 'year',
|
|
51
|
+
year: 'year',
|
|
52
|
+
};
|
|
9
53
|
|
|
10
54
|
export function normalizeUnits(units) {
|
|
11
55
|
return typeof units === 'string'
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { makeGetSet } from '../moment/get-set';
|
|
2
2
|
import { addFormatToken } from '../format/format';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
addRegexToken,
|
|
5
|
+
match1to2,
|
|
6
|
+
match2,
|
|
7
|
+
match1to2NoLeadingZero,
|
|
8
|
+
} from '../parse/regex';
|
|
6
9
|
import { addParseToken } from '../parse/token';
|
|
7
10
|
import { DATE } from './constants';
|
|
8
11
|
import toInt from '../utils/to-int';
|
|
@@ -11,16 +14,9 @@ import toInt from '../utils/to-int';
|
|
|
11
14
|
|
|
12
15
|
addFormatToken('D', ['DD', 2], 'Do', 'date');
|
|
13
16
|
|
|
14
|
-
// ALIASES
|
|
15
|
-
|
|
16
|
-
addUnitAlias('date', 'D');
|
|
17
|
-
|
|
18
|
-
// PRIORITY
|
|
19
|
-
addUnitPriority('date', 9);
|
|
20
|
-
|
|
21
17
|
// PARSING
|
|
22
18
|
|
|
23
|
-
addRegexToken('D', match1to2);
|
|
19
|
+
addRegexToken('D', match1to2, match1to2NoLeadingZero);
|
|
24
20
|
addRegexToken('DD', match1to2, match2);
|
|
25
21
|
addRegexToken('Do', function (isStrict, locale) {
|
|
26
22
|
// TODO: Remove "ordinalParse" fallback in next major release.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
+
import { get } from '../moment/get-set';
|
|
1
2
|
import { addFormatToken } from '../format/format';
|
|
2
|
-
import { addUnitAlias } from './aliases';
|
|
3
|
-
import { addUnitPriority } from './priorities';
|
|
4
3
|
import {
|
|
5
4
|
addRegexToken,
|
|
6
5
|
match1to2,
|
|
6
|
+
match5to6,
|
|
7
7
|
matchWord,
|
|
8
8
|
regexEscape,
|
|
9
9
|
} from '../parse/regex';
|
|
10
10
|
import { addWeekParseToken } from '../parse/token';
|
|
11
|
+
import { HOUR, MINUTE } from './constants';
|
|
11
12
|
import toInt from '../utils/to-int';
|
|
13
|
+
import zeroFill from '../utils/zero-fill';
|
|
12
14
|
import isArray from '../utils/is-array';
|
|
13
15
|
import indexOf from '../utils/index-of';
|
|
14
16
|
import hasOwnProp from '../utils/has-own-prop';
|
|
@@ -33,23 +35,21 @@ addFormatToken('dddd', 0, 0, function (format) {
|
|
|
33
35
|
|
|
34
36
|
addFormatToken('e', 0, 0, 'weekday');
|
|
35
37
|
addFormatToken('E', 0, 0, 'isoWeekday');
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
addUnitPriority('day', 11);
|
|
45
|
-
addUnitPriority('weekday', 11);
|
|
46
|
-
addUnitPriority('isoWeekday', 11);
|
|
38
|
+
addFormatToken('eHHmm', 0, 0, function () {
|
|
39
|
+
return (
|
|
40
|
+
'' +
|
|
41
|
+
this.weekday() +
|
|
42
|
+
zeroFill(this.hours(), 2) +
|
|
43
|
+
zeroFill(this.minutes(), 2)
|
|
44
|
+
);
|
|
45
|
+
});
|
|
47
46
|
|
|
48
47
|
// PARSING
|
|
49
48
|
|
|
50
49
|
addRegexToken('d', match1to2);
|
|
51
50
|
addRegexToken('e', match1to2);
|
|
52
51
|
addRegexToken('E', match1to2);
|
|
52
|
+
addRegexToken('eHHmm', match5to6);
|
|
53
53
|
addRegexToken('dd', function (isStrict, locale) {
|
|
54
54
|
return locale.weekdaysMinRegex(isStrict);
|
|
55
55
|
});
|
|
@@ -74,6 +74,14 @@ addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
|
|
|
74
74
|
week[token] = toInt(input);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
|
+
addWeekParseToken('eHHmm', function (input, week, config) {
|
|
78
|
+
var weekdayEnd = input.length - 4;
|
|
79
|
+
|
|
80
|
+
week.e = toInt(input.substr(0, weekdayEnd));
|
|
81
|
+
config._a[HOUR] = toInt(input.substr(weekdayEnd, 2));
|
|
82
|
+
config._a[MINUTE] = toInt(input.substr(weekdayEnd + 2));
|
|
83
|
+
});
|
|
84
|
+
|
|
77
85
|
// HELPERS
|
|
78
86
|
|
|
79
87
|
function parseWeekday(input, locale) {
|
|
@@ -111,7 +119,19 @@ var defaultLocaleWeekdays =
|
|
|
111
119
|
defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
|
|
112
120
|
defaultWeekdaysRegex = matchWord,
|
|
113
121
|
defaultWeekdaysShortRegex = matchWord,
|
|
114
|
-
defaultWeekdaysMinRegex = matchWord
|
|
122
|
+
defaultWeekdaysMinRegex = matchWord,
|
|
123
|
+
weekdaysParseProperties = [
|
|
124
|
+
'weekdaysParse',
|
|
125
|
+
'fullWeekdaysParse',
|
|
126
|
+
'shortWeekdaysParse',
|
|
127
|
+
'minWeekdaysParse',
|
|
128
|
+
'weekdaysRegex',
|
|
129
|
+
'weekdaysShortRegex',
|
|
130
|
+
'weekdaysMinRegex',
|
|
131
|
+
'weekdaysStrictRegex',
|
|
132
|
+
'weekdaysShortStrictRegex',
|
|
133
|
+
'weekdaysMinStrictRegex',
|
|
134
|
+
];
|
|
115
135
|
|
|
116
136
|
export {
|
|
117
137
|
defaultLocaleWeekdays,
|
|
@@ -119,6 +139,16 @@ export {
|
|
|
119
139
|
defaultLocaleWeekdaysMin,
|
|
120
140
|
};
|
|
121
141
|
|
|
142
|
+
export function clearWeekdaysParseCache(locale, config) {
|
|
143
|
+
var i, prop;
|
|
144
|
+
for (i = 0; i < weekdaysParseProperties.length; i++) {
|
|
145
|
+
prop = weekdaysParseProperties[i];
|
|
146
|
+
if (!hasOwnProp(config, prop)) {
|
|
147
|
+
delete locale['_' + prop];
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
122
152
|
export function localeWeekdays(m, format) {
|
|
123
153
|
var weekdays = isArray(this._weekdays)
|
|
124
154
|
? this._weekdays
|
|
@@ -130,24 +160,24 @@ export function localeWeekdays(m, format) {
|
|
|
130
160
|
return m === true
|
|
131
161
|
? shiftWeekdays(weekdays, this._week.dow)
|
|
132
162
|
: m
|
|
133
|
-
|
|
134
|
-
|
|
163
|
+
? weekdays[m.day()]
|
|
164
|
+
: weekdays;
|
|
135
165
|
}
|
|
136
166
|
|
|
137
167
|
export function localeWeekdaysShort(m) {
|
|
138
168
|
return m === true
|
|
139
169
|
? shiftWeekdays(this._weekdaysShort, this._week.dow)
|
|
140
170
|
: m
|
|
141
|
-
|
|
142
|
-
|
|
171
|
+
? this._weekdaysShort[m.day()]
|
|
172
|
+
: this._weekdaysShort;
|
|
143
173
|
}
|
|
144
174
|
|
|
145
175
|
export function localeWeekdaysMin(m) {
|
|
146
176
|
return m === true
|
|
147
177
|
? shiftWeekdays(this._weekdaysMin, this._week.dow)
|
|
148
178
|
: m
|
|
149
|
-
|
|
150
|
-
|
|
179
|
+
? this._weekdaysMin[m.day()]
|
|
180
|
+
: this._weekdaysMin;
|
|
151
181
|
}
|
|
152
182
|
|
|
153
183
|
function handleStrictParse(weekdayName, format, strict) {
|
|
@@ -296,7 +326,8 @@ export function getSetDayOfWeek(input) {
|
|
|
296
326
|
if (!this.isValid()) {
|
|
297
327
|
return input != null ? this : NaN;
|
|
298
328
|
}
|
|
299
|
-
|
|
329
|
+
|
|
330
|
+
var day = get(this, 'Day');
|
|
300
331
|
if (input != null) {
|
|
301
332
|
input = parseWeekday(input, this.localeData());
|
|
302
333
|
return this.add(input - day, 'd');
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import { addFormatToken } from '../format/format';
|
|
2
|
-
import { addUnitAlias } from './aliases';
|
|
3
|
-
import { addUnitPriority } from './priorities';
|
|
4
2
|
import { addRegexToken, match3, match1to3 } from '../parse/regex';
|
|
5
3
|
import { addParseToken } from '../parse/token';
|
|
6
4
|
import toInt from '../utils/to-int';
|
|
@@ -9,13 +7,6 @@ import toInt from '../utils/to-int';
|
|
|
9
7
|
|
|
10
8
|
addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
|
|
11
9
|
|
|
12
|
-
// ALIASES
|
|
13
|
-
|
|
14
|
-
addUnitAlias('dayOfYear', 'DDD');
|
|
15
|
-
|
|
16
|
-
// PRIORITY
|
|
17
|
-
addUnitPriority('dayOfYear', 4);
|
|
18
|
-
|
|
19
10
|
// PARSING
|
|
20
11
|
|
|
21
12
|
addRegexToken('DDD', match1to3);
|
|
@@ -265,16 +265,22 @@ function computeErasParse() {
|
|
|
265
265
|
mixedPieces = [],
|
|
266
266
|
i,
|
|
267
267
|
l,
|
|
268
|
+
erasName,
|
|
269
|
+
erasAbbr,
|
|
270
|
+
erasNarrow,
|
|
268
271
|
eras = this.eras();
|
|
269
272
|
|
|
270
273
|
for (i = 0, l = eras.length; i < l; ++i) {
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
274
|
+
erasName = regexEscape(eras[i].name);
|
|
275
|
+
erasAbbr = regexEscape(eras[i].abbr);
|
|
276
|
+
erasNarrow = regexEscape(eras[i].narrow);
|
|
277
|
+
|
|
278
|
+
namePieces.push(erasName);
|
|
279
|
+
abbrPieces.push(erasAbbr);
|
|
280
|
+
narrowPieces.push(erasNarrow);
|
|
281
|
+
mixedPieces.push(erasName);
|
|
282
|
+
mixedPieces.push(erasAbbr);
|
|
283
|
+
mixedPieces.push(erasNarrow);
|
|
278
284
|
}
|
|
279
285
|
|
|
280
286
|
this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { makeGetSet } from '../moment/get-set';
|
|
2
2
|
import { addFormatToken } from '../format/format';
|
|
3
|
-
import { addUnitAlias } from './aliases';
|
|
4
|
-
import { addUnitPriority } from './priorities';
|
|
5
3
|
import {
|
|
6
4
|
addRegexToken,
|
|
7
5
|
match1to2,
|
|
8
6
|
match2,
|
|
9
7
|
match3to4,
|
|
10
8
|
match5to6,
|
|
9
|
+
match1to2NoLeadingZero,
|
|
10
|
+
match1to2HasZero,
|
|
11
11
|
} from '../parse/regex';
|
|
12
12
|
import { addParseToken } from '../parse/token';
|
|
13
13
|
import { HOUR, MINUTE, SECOND } from './constants';
|
|
@@ -68,13 +68,6 @@ function meridiem(token, lowercase) {
|
|
|
68
68
|
meridiem('a', true);
|
|
69
69
|
meridiem('A', false);
|
|
70
70
|
|
|
71
|
-
// ALIASES
|
|
72
|
-
|
|
73
|
-
addUnitAlias('hour', 'h');
|
|
74
|
-
|
|
75
|
-
// PRIORITY
|
|
76
|
-
addUnitPriority('hour', 13);
|
|
77
|
-
|
|
78
71
|
// PARSING
|
|
79
72
|
|
|
80
73
|
function matchMeridiem(isStrict, locale) {
|
|
@@ -83,9 +76,9 @@ function matchMeridiem(isStrict, locale) {
|
|
|
83
76
|
|
|
84
77
|
addRegexToken('a', matchMeridiem);
|
|
85
78
|
addRegexToken('A', matchMeridiem);
|
|
86
|
-
addRegexToken('H', match1to2);
|
|
87
|
-
addRegexToken('h', match1to2);
|
|
88
|
-
addRegexToken('k', match1to2);
|
|
79
|
+
addRegexToken('H', match1to2, match1to2HasZero);
|
|
80
|
+
addRegexToken('h', match1to2, match1to2NoLeadingZero);
|
|
81
|
+
addRegexToken('k', match1to2, match1to2NoLeadingZero);
|
|
89
82
|
addRegexToken('HH', match1to2, match2);
|
|
90
83
|
addRegexToken('hh', match1to2, match2);
|
|
91
84
|
addRegexToken('kk', match1to2, match2);
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { makeGetSet } from '../moment/get-set';
|
|
2
2
|
import { addFormatToken } from '../format/format';
|
|
3
|
-
import { addUnitAlias } from './aliases';
|
|
4
|
-
import { addUnitPriority } from './priorities';
|
|
5
3
|
import {
|
|
6
4
|
addRegexToken,
|
|
7
5
|
match1,
|
|
@@ -44,14 +42,6 @@ addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
|
|
|
44
42
|
return this.millisecond() * 1000000;
|
|
45
43
|
});
|
|
46
44
|
|
|
47
|
-
// ALIASES
|
|
48
|
-
|
|
49
|
-
addUnitAlias('millisecond', 'ms');
|
|
50
|
-
|
|
51
|
-
// PRIORITY
|
|
52
|
-
|
|
53
|
-
addUnitPriority('millisecond', 16);
|
|
54
|
-
|
|
55
45
|
// PARSING
|
|
56
46
|
|
|
57
47
|
addRegexToken('S', match1to3, match1);
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { makeGetSet } from '../moment/get-set';
|
|
2
2
|
import { addFormatToken } from '../format/format';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import {
|
|
4
|
+
addRegexToken,
|
|
5
|
+
match1to2,
|
|
6
|
+
match2,
|
|
7
|
+
match1to2HasZero,
|
|
8
|
+
} from '../parse/regex';
|
|
6
9
|
import { addParseToken } from '../parse/token';
|
|
7
10
|
import { MINUTE } from './constants';
|
|
8
11
|
|
|
@@ -10,17 +13,9 @@ import { MINUTE } from './constants';
|
|
|
10
13
|
|
|
11
14
|
addFormatToken('m', ['mm', 2], 0, 'minute');
|
|
12
15
|
|
|
13
|
-
// ALIASES
|
|
14
|
-
|
|
15
|
-
addUnitAlias('minute', 'm');
|
|
16
|
-
|
|
17
|
-
// PRIORITY
|
|
18
|
-
|
|
19
|
-
addUnitPriority('minute', 14);
|
|
20
|
-
|
|
21
16
|
// PARSING
|
|
22
17
|
|
|
23
|
-
addRegexToken('m', match1to2);
|
|
18
|
+
addRegexToken('m', match1to2, match1to2HasZero);
|
|
24
19
|
addRegexToken('mm', match1to2, match2);
|
|
25
20
|
addParseToken(['m', 'mm'], MINUTE);
|
|
26
21
|
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import { get } from '../moment/get-set';
|
|
2
2
|
import hasOwnProp from '../utils/has-own-prop';
|
|
3
3
|
import { addFormatToken } from '../format/format';
|
|
4
|
-
import { addUnitAlias } from './aliases';
|
|
5
|
-
import { addUnitPriority } from './priorities';
|
|
6
4
|
import {
|
|
7
5
|
addRegexToken,
|
|
8
6
|
match1to2,
|
|
9
7
|
match2,
|
|
10
8
|
matchWord,
|
|
11
9
|
regexEscape,
|
|
10
|
+
match1to2NoLeadingZero,
|
|
12
11
|
} from '../parse/regex';
|
|
13
12
|
import { addParseToken } from '../parse/token';
|
|
14
13
|
import { hooks } from '../utils/hooks';
|
|
@@ -49,17 +48,9 @@ addFormatToken('MMMM', 0, 0, function (format) {
|
|
|
49
48
|
return this.localeData().months(this, format);
|
|
50
49
|
});
|
|
51
50
|
|
|
52
|
-
// ALIASES
|
|
53
|
-
|
|
54
|
-
addUnitAlias('month', 'M');
|
|
55
|
-
|
|
56
|
-
// PRIORITY
|
|
57
|
-
|
|
58
|
-
addUnitPriority('month', 8);
|
|
59
|
-
|
|
60
51
|
// PARSING
|
|
61
52
|
|
|
62
|
-
addRegexToken('M', match1to2);
|
|
53
|
+
addRegexToken('M', match1to2, match1to2NoLeadingZero);
|
|
63
54
|
addRegexToken('MM', match1to2, match2);
|
|
64
55
|
addRegexToken('MMM', function (isStrict, locale) {
|
|
65
56
|
return locale.monthsShortRegex(isStrict);
|
|
@@ -92,10 +83,29 @@ var defaultLocaleMonths =
|
|
|
92
83
|
'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
|
|
93
84
|
MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
|
|
94
85
|
defaultMonthsShortRegex = matchWord,
|
|
95
|
-
defaultMonthsRegex = matchWord
|
|
86
|
+
defaultMonthsRegex = matchWord,
|
|
87
|
+
monthsParseProperties = [
|
|
88
|
+
'monthsParse',
|
|
89
|
+
'longMonthsParse',
|
|
90
|
+
'shortMonthsParse',
|
|
91
|
+
'monthsRegex',
|
|
92
|
+
'monthsShortRegex',
|
|
93
|
+
'monthsStrictRegex',
|
|
94
|
+
'monthsShortStrictRegex',
|
|
95
|
+
];
|
|
96
96
|
|
|
97
97
|
export { defaultLocaleMonths, defaultLocaleMonthsShort };
|
|
98
98
|
|
|
99
|
+
export function clearMonthsParseCache(locale, config) {
|
|
100
|
+
var i, prop;
|
|
101
|
+
for (i = 0; i < monthsParseProperties.length; i++) {
|
|
102
|
+
prop = monthsParseProperties[i];
|
|
103
|
+
if (!hasOwnProp(config, prop)) {
|
|
104
|
+
delete locale['_' + prop];
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
99
109
|
export function localeMonths(m, format) {
|
|
100
110
|
if (!m) {
|
|
101
111
|
return isArray(this._months)
|
|
@@ -227,8 +237,6 @@ export function localeMonthsParse(monthName, format, strict) {
|
|
|
227
237
|
// MOMENTS
|
|
228
238
|
|
|
229
239
|
export function setMonth(mom, value) {
|
|
230
|
-
var dayOfMonth;
|
|
231
|
-
|
|
232
240
|
if (!mom.isValid()) {
|
|
233
241
|
// No op
|
|
234
242
|
return mom;
|
|
@@ -246,8 +254,13 @@ export function setMonth(mom, value) {
|
|
|
246
254
|
}
|
|
247
255
|
}
|
|
248
256
|
|
|
249
|
-
|
|
250
|
-
|
|
257
|
+
var month = value,
|
|
258
|
+
date = mom.date();
|
|
259
|
+
|
|
260
|
+
date = date < 29 ? date : Math.min(date, daysInMonth(mom.year(), month));
|
|
261
|
+
void (mom._isUTC
|
|
262
|
+
? mom._d.setUTCMonth(month, date)
|
|
263
|
+
: mom._d.setMonth(month, date));
|
|
251
264
|
return mom;
|
|
252
265
|
}
|
|
253
266
|
|
|
@@ -314,27 +327,24 @@ function computeMonthsParse() {
|
|
|
314
327
|
longPieces = [],
|
|
315
328
|
mixedPieces = [],
|
|
316
329
|
i,
|
|
317
|
-
mom
|
|
330
|
+
mom,
|
|
331
|
+
shortP,
|
|
332
|
+
longP;
|
|
318
333
|
for (i = 0; i < 12; i++) {
|
|
319
334
|
// make the regex if we don't have it already
|
|
320
335
|
mom = createUTC([2000, i]);
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
336
|
+
shortP = regexEscape(this.monthsShort(mom, ''));
|
|
337
|
+
longP = regexEscape(this.months(mom, ''));
|
|
338
|
+
shortPieces.push(shortP);
|
|
339
|
+
longPieces.push(longP);
|
|
340
|
+
mixedPieces.push(longP);
|
|
341
|
+
mixedPieces.push(shortP);
|
|
325
342
|
}
|
|
326
343
|
// Sorting makes sure if one month (or abbr) is a prefix of another it
|
|
327
344
|
// will match the longer piece.
|
|
328
345
|
shortPieces.sort(cmpLenRev);
|
|
329
346
|
longPieces.sort(cmpLenRev);
|
|
330
347
|
mixedPieces.sort(cmpLenRev);
|
|
331
|
-
for (i = 0; i < 12; i++) {
|
|
332
|
-
shortPieces[i] = regexEscape(shortPieces[i]);
|
|
333
|
-
longPieces[i] = regexEscape(longPieces[i]);
|
|
334
|
-
}
|
|
335
|
-
for (i = 0; i < 24; i++) {
|
|
336
|
-
mixedPieces[i] = regexEscape(mixedPieces[i]);
|
|
337
|
-
}
|
|
338
348
|
|
|
339
349
|
this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
|
|
340
350
|
this._monthsShortRegex = this._monthsRegex;
|