@fullcalendar/moment 5.11.2 → 6.0.0-beta.1
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/main.cjs.js +19 -19
- package/main.global.js +19 -19
- package/main.global.min.js +2 -2
- package/main.js +19 -19
- package/main.js.map +1 -1
- package/package.json +3 -3
package/main.cjs.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar
|
|
2
|
+
FullCalendar v6.0.0-beta.1
|
|
3
3
|
Docs & License: https://fullcalendar.io/
|
|
4
4
|
(c) 2022 Adam Shaw
|
|
5
5
|
*/
|
|
@@ -18,17 +18,17 @@ function toMoment(date, calendar) {
|
|
|
18
18
|
if (!(calendar instanceof common.CalendarApi)) {
|
|
19
19
|
throw new Error('must supply a CalendarApi instance');
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
let { dateEnv } = calendar.getCurrentData();
|
|
22
22
|
return convertToMoment(date, dateEnv.timeZone, null, dateEnv.locale.codes[0]);
|
|
23
23
|
}
|
|
24
24
|
function toMomentDuration(fcDuration) {
|
|
25
25
|
return moment__default['default'].duration(fcDuration); // moment accepts all the props that fc.Duration already has!
|
|
26
26
|
}
|
|
27
27
|
function formatWithCmdStr(cmdStr, arg) {
|
|
28
|
-
|
|
28
|
+
let cmd = parseCmdStr(cmdStr);
|
|
29
29
|
if (arg.end) {
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
let startMom = convertToMoment(arg.start.array, arg.timeZone, arg.start.timeZoneOffset, arg.localeCodes[0]);
|
|
31
|
+
let endMom = convertToMoment(arg.end.array, arg.timeZone, arg.end.timeZoneOffset, arg.localeCodes[0]);
|
|
32
32
|
return formatRange(cmd, createMomentFormatFunc(startMom), createMomentFormatFunc(endMom), arg.defaultSeparator);
|
|
33
33
|
}
|
|
34
34
|
return convertToMoment(arg.date.array, arg.timeZone, arg.date.timeZoneOffset, arg.localeCodes[0]).format(cmd.whole); // TODO: test for this
|
|
@@ -37,11 +37,11 @@ var main = common.createPlugin({
|
|
|
37
37
|
cmdFormatter: formatWithCmdStr,
|
|
38
38
|
});
|
|
39
39
|
function createMomentFormatFunc(mom) {
|
|
40
|
-
return
|
|
41
|
-
);
|
|
40
|
+
return (cmdStr) => (cmdStr ? mom.format(cmdStr) : '' // because calling with blank string results in ISO8601 :(
|
|
41
|
+
);
|
|
42
42
|
}
|
|
43
43
|
function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
|
44
|
-
|
|
44
|
+
let mom;
|
|
45
45
|
if (timeZone === 'local') {
|
|
46
46
|
mom = moment__default['default'](input);
|
|
47
47
|
}
|
|
@@ -61,12 +61,12 @@ function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
|
|
61
61
|
return mom;
|
|
62
62
|
}
|
|
63
63
|
function parseCmdStr(cmdStr) {
|
|
64
|
-
|
|
64
|
+
let parts = cmdStr.match(/^(.*?)\{(.*)\}(.*)$/); // TODO: lookbehinds for escape characters
|
|
65
65
|
if (parts) {
|
|
66
|
-
|
|
66
|
+
let middle = parseCmdStr(parts[2]);
|
|
67
67
|
return {
|
|
68
68
|
head: parts[1],
|
|
69
|
-
middle
|
|
69
|
+
middle,
|
|
70
70
|
tail: parts[3],
|
|
71
71
|
whole: parts[1] + middle.whole + parts[3],
|
|
72
72
|
};
|
|
@@ -80,20 +80,20 @@ function parseCmdStr(cmdStr) {
|
|
|
80
80
|
}
|
|
81
81
|
function formatRange(cmd, formatStart, formatEnd, separator) {
|
|
82
82
|
if (cmd.middle) {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
83
|
+
let startHead = formatStart(cmd.head);
|
|
84
|
+
let startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
|
85
|
+
let startTail = formatStart(cmd.tail);
|
|
86
|
+
let endHead = formatEnd(cmd.head);
|
|
87
|
+
let endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
|
88
|
+
let endTail = formatEnd(cmd.tail);
|
|
89
89
|
if (startHead === endHead && startTail === endTail) {
|
|
90
90
|
return startHead +
|
|
91
91
|
(startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +
|
|
92
92
|
startTail;
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
let startWhole = formatStart(cmd.whole);
|
|
96
|
+
let endWhole = formatEnd(cmd.whole);
|
|
97
97
|
if (startWhole === endWhole) {
|
|
98
98
|
return startWhole;
|
|
99
99
|
}
|
package/main.global.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar
|
|
2
|
+
FullCalendar v6.0.0-beta.1
|
|
3
3
|
Docs & License: https://fullcalendar.io/
|
|
4
4
|
(c) 2022 Adam Shaw
|
|
5
5
|
*/
|
|
@@ -14,17 +14,17 @@ var FullCalendarMoment = (function (exports, common, moment) {
|
|
|
14
14
|
if (!(calendar instanceof common.CalendarApi)) {
|
|
15
15
|
throw new Error('must supply a CalendarApi instance');
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
let { dateEnv } = calendar.getCurrentData();
|
|
18
18
|
return convertToMoment(date, dateEnv.timeZone, null, dateEnv.locale.codes[0]);
|
|
19
19
|
}
|
|
20
20
|
function toMomentDuration(fcDuration) {
|
|
21
21
|
return moment__default['default'].duration(fcDuration); // moment accepts all the props that fc.Duration already has!
|
|
22
22
|
}
|
|
23
23
|
function formatWithCmdStr(cmdStr, arg) {
|
|
24
|
-
|
|
24
|
+
let cmd = parseCmdStr(cmdStr);
|
|
25
25
|
if (arg.end) {
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
let startMom = convertToMoment(arg.start.array, arg.timeZone, arg.start.timeZoneOffset, arg.localeCodes[0]);
|
|
27
|
+
let endMom = convertToMoment(arg.end.array, arg.timeZone, arg.end.timeZoneOffset, arg.localeCodes[0]);
|
|
28
28
|
return formatRange(cmd, createMomentFormatFunc(startMom), createMomentFormatFunc(endMom), arg.defaultSeparator);
|
|
29
29
|
}
|
|
30
30
|
return convertToMoment(arg.date.array, arg.timeZone, arg.date.timeZoneOffset, arg.localeCodes[0]).format(cmd.whole); // TODO: test for this
|
|
@@ -33,11 +33,11 @@ var FullCalendarMoment = (function (exports, common, moment) {
|
|
|
33
33
|
cmdFormatter: formatWithCmdStr,
|
|
34
34
|
});
|
|
35
35
|
function createMomentFormatFunc(mom) {
|
|
36
|
-
return
|
|
37
|
-
);
|
|
36
|
+
return (cmdStr) => (cmdStr ? mom.format(cmdStr) : '' // because calling with blank string results in ISO8601 :(
|
|
37
|
+
);
|
|
38
38
|
}
|
|
39
39
|
function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
|
40
|
-
|
|
40
|
+
let mom;
|
|
41
41
|
if (timeZone === 'local') {
|
|
42
42
|
mom = moment__default['default'](input);
|
|
43
43
|
}
|
|
@@ -57,12 +57,12 @@ var FullCalendarMoment = (function (exports, common, moment) {
|
|
|
57
57
|
return mom;
|
|
58
58
|
}
|
|
59
59
|
function parseCmdStr(cmdStr) {
|
|
60
|
-
|
|
60
|
+
let parts = cmdStr.match(/^(.*?)\{(.*)\}(.*)$/); // TODO: lookbehinds for escape characters
|
|
61
61
|
if (parts) {
|
|
62
|
-
|
|
62
|
+
let middle = parseCmdStr(parts[2]);
|
|
63
63
|
return {
|
|
64
64
|
head: parts[1],
|
|
65
|
-
middle
|
|
65
|
+
middle,
|
|
66
66
|
tail: parts[3],
|
|
67
67
|
whole: parts[1] + middle.whole + parts[3],
|
|
68
68
|
};
|
|
@@ -76,20 +76,20 @@ var FullCalendarMoment = (function (exports, common, moment) {
|
|
|
76
76
|
}
|
|
77
77
|
function formatRange(cmd, formatStart, formatEnd, separator) {
|
|
78
78
|
if (cmd.middle) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
79
|
+
let startHead = formatStart(cmd.head);
|
|
80
|
+
let startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
|
81
|
+
let startTail = formatStart(cmd.tail);
|
|
82
|
+
let endHead = formatEnd(cmd.head);
|
|
83
|
+
let endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
|
84
|
+
let endTail = formatEnd(cmd.tail);
|
|
85
85
|
if (startHead === endHead && startTail === endTail) {
|
|
86
86
|
return startHead +
|
|
87
87
|
(startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +
|
|
88
88
|
startTail;
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
let startWhole = formatStart(cmd.whole);
|
|
92
|
+
let endWhole = formatEnd(cmd.whole);
|
|
93
93
|
if (startWhole === endWhole) {
|
|
94
94
|
return startWhole;
|
|
95
95
|
}
|
package/main.global.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar
|
|
2
|
+
FullCalendar v6.0.0-beta.1
|
|
3
3
|
Docs & License: https://fullcalendar.io/
|
|
4
4
|
(c) 2022 Adam Shaw
|
|
5
5
|
*/
|
|
6
|
-
var FullCalendarMoment=function(e,t,
|
|
6
|
+
var FullCalendarMoment=function(e,t,l){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=n(l);var r=t.createPlugin({cmdFormatter:function(e,t){let l=d(e);if(t.end){let e=u(t.start.array,t.timeZone,t.start.timeZoneOffset,t.localeCodes[0]),n=u(t.end.array,t.timeZone,t.end.timeZoneOffset,t.localeCodes[0]);return i(l,o(e),o(n),t.defaultSeparator)}return u(t.date.array,t.timeZone,t.date.timeZoneOffset,t.localeCodes[0]).format(l.whole)}});function o(e){return t=>t?e.format(t):""}function u(e,t,l,n){let r;return"local"===t?r=a.default(e):"UTC"===t?r=a.default.utc(e):a.default.tz?r=a.default.tz(e,t):(r=a.default.utc(e),null!=l&&r.utcOffset(l)),r.locale(n),r}function d(e){let t=e.match(/^(.*?)\{(.*)\}(.*)$/);if(t){let e=d(t[2]);return{head:t[1],middle:e,tail:t[3],whole:t[1]+e.whole+t[3]}}return{head:null,middle:null,tail:null,whole:e}}function i(e,t,l,n){if(e.middle){let a=t(e.head),r=i(e.middle,t,l,n),o=t(e.tail),u=l(e.head),d=i(e.middle,t,l,n),f=l(e.tail);if(a===u&&o===f)return a+(r===d?r:r+n+d)+o}let a=t(e.whole),r=l(e.whole);return a===r?a:a+n+r}return t.globalPlugins.push(r),e.default=r,e.toMoment=function(e,l){if(!(l instanceof t.CalendarApi))throw new Error("must supply a CalendarApi instance");let{dateEnv:n}=l.getCurrentData();return u(e,n.timeZone,null,n.locale.codes[0])},e.toMomentDuration=function(e){return a.default.duration(e)},Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,moment);
|
package/main.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar
|
|
2
|
+
FullCalendar v6.0.0-beta.1
|
|
3
3
|
Docs & License: https://fullcalendar.io/
|
|
4
4
|
(c) 2022 Adam Shaw
|
|
5
5
|
*/
|
|
@@ -10,17 +10,17 @@ function toMoment(date, calendar) {
|
|
|
10
10
|
if (!(calendar instanceof CalendarApi)) {
|
|
11
11
|
throw new Error('must supply a CalendarApi instance');
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
let { dateEnv } = calendar.getCurrentData();
|
|
14
14
|
return convertToMoment(date, dateEnv.timeZone, null, dateEnv.locale.codes[0]);
|
|
15
15
|
}
|
|
16
16
|
function toMomentDuration(fcDuration) {
|
|
17
17
|
return moment.duration(fcDuration); // moment accepts all the props that fc.Duration already has!
|
|
18
18
|
}
|
|
19
19
|
function formatWithCmdStr(cmdStr, arg) {
|
|
20
|
-
|
|
20
|
+
let cmd = parseCmdStr(cmdStr);
|
|
21
21
|
if (arg.end) {
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
let startMom = convertToMoment(arg.start.array, arg.timeZone, arg.start.timeZoneOffset, arg.localeCodes[0]);
|
|
23
|
+
let endMom = convertToMoment(arg.end.array, arg.timeZone, arg.end.timeZoneOffset, arg.localeCodes[0]);
|
|
24
24
|
return formatRange(cmd, createMomentFormatFunc(startMom), createMomentFormatFunc(endMom), arg.defaultSeparator);
|
|
25
25
|
}
|
|
26
26
|
return convertToMoment(arg.date.array, arg.timeZone, arg.date.timeZoneOffset, arg.localeCodes[0]).format(cmd.whole); // TODO: test for this
|
|
@@ -29,11 +29,11 @@ var main = createPlugin({
|
|
|
29
29
|
cmdFormatter: formatWithCmdStr,
|
|
30
30
|
});
|
|
31
31
|
function createMomentFormatFunc(mom) {
|
|
32
|
-
return
|
|
33
|
-
);
|
|
32
|
+
return (cmdStr) => (cmdStr ? mom.format(cmdStr) : '' // because calling with blank string results in ISO8601 :(
|
|
33
|
+
);
|
|
34
34
|
}
|
|
35
35
|
function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
|
36
|
-
|
|
36
|
+
let mom;
|
|
37
37
|
if (timeZone === 'local') {
|
|
38
38
|
mom = moment(input);
|
|
39
39
|
}
|
|
@@ -53,12 +53,12 @@ function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
|
|
53
53
|
return mom;
|
|
54
54
|
}
|
|
55
55
|
function parseCmdStr(cmdStr) {
|
|
56
|
-
|
|
56
|
+
let parts = cmdStr.match(/^(.*?)\{(.*)\}(.*)$/); // TODO: lookbehinds for escape characters
|
|
57
57
|
if (parts) {
|
|
58
|
-
|
|
58
|
+
let middle = parseCmdStr(parts[2]);
|
|
59
59
|
return {
|
|
60
60
|
head: parts[1],
|
|
61
|
-
middle
|
|
61
|
+
middle,
|
|
62
62
|
tail: parts[3],
|
|
63
63
|
whole: parts[1] + middle.whole + parts[3],
|
|
64
64
|
};
|
|
@@ -72,20 +72,20 @@ function parseCmdStr(cmdStr) {
|
|
|
72
72
|
}
|
|
73
73
|
function formatRange(cmd, formatStart, formatEnd, separator) {
|
|
74
74
|
if (cmd.middle) {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
75
|
+
let startHead = formatStart(cmd.head);
|
|
76
|
+
let startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
|
77
|
+
let startTail = formatStart(cmd.tail);
|
|
78
|
+
let endHead = formatEnd(cmd.head);
|
|
79
|
+
let endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
|
|
80
|
+
let endTail = formatEnd(cmd.tail);
|
|
81
81
|
if (startHead === endHead && startTail === endTail) {
|
|
82
82
|
return startHead +
|
|
83
83
|
(startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +
|
|
84
84
|
startTail;
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
|
|
87
|
+
let startWhole = formatStart(cmd.whole);
|
|
88
|
+
let endWhole = formatEnd(cmd.whole);
|
|
89
89
|
if (startWhole === endWhole) {
|
|
90
90
|
return startWhole;
|
|
91
91
|
}
|
package/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.js","sources":["src/main.ts"],"sourcesContent":["import moment from 'moment'\nimport { Duration, VerboseFormattingArg, createPlugin, CalendarApi } from '@fullcalendar/common'\n\nexport function toMoment(date: Date, calendar: CalendarApi): moment.Moment {\n if (!(calendar instanceof CalendarApi)) {\n throw new Error('must supply a CalendarApi instance')\n }\n\n let { dateEnv } = calendar.getCurrentData()\n\n return convertToMoment(\n date,\n dateEnv.timeZone,\n null,\n dateEnv.locale.codes[0],\n )\n}\n\nexport function toMomentDuration(fcDuration: Duration): moment.Duration {\n return moment.duration(fcDuration) // moment accepts all the props that fc.Duration already has!\n}\n\nfunction formatWithCmdStr(cmdStr: string, arg: VerboseFormattingArg) {\n let cmd = parseCmdStr(cmdStr)\n\n if (arg.end) {\n let startMom = convertToMoment(\n arg.start.array,\n arg.timeZone,\n arg.start.timeZoneOffset,\n arg.localeCodes[0],\n )\n let endMom = convertToMoment(\n arg.end.array,\n arg.timeZone,\n arg.end.timeZoneOffset,\n arg.localeCodes[0],\n )\n return formatRange(\n cmd,\n createMomentFormatFunc(startMom),\n createMomentFormatFunc(endMom),\n arg.defaultSeparator,\n )\n }\n\n return convertToMoment(\n arg.date.array,\n arg.timeZone,\n arg.date.timeZoneOffset,\n arg.localeCodes[0],\n ).format(cmd.whole) // TODO: test for this\n}\n\nexport default createPlugin({\n cmdFormatter: formatWithCmdStr,\n})\n\nfunction createMomentFormatFunc(mom: moment.Moment) {\n return (cmdStr) => (\n cmdStr ? mom.format(cmdStr) : '' // because calling with blank string results in ISO8601 :(\n )\n}\n\nfunction convertToMoment(input: any, timeZone: string, timeZoneOffset: number | null, locale: string): moment.Moment {\n let mom: moment.Moment\n\n if (timeZone === 'local') {\n mom = moment(input)\n } else if (timeZone === 'UTC') {\n mom = moment.utc(input)\n } else if ((moment as any).tz) {\n mom = (moment as any).tz(input, timeZone)\n } else {\n mom = moment.utc(input)\n\n if (timeZoneOffset != null) {\n mom.utcOffset(timeZoneOffset)\n }\n }\n\n mom.locale(locale)\n\n return mom\n}\n\n/* Range Formatting (duplicate code as other date plugins)\n----------------------------------------------------------------------------------------------------*/\n\ninterface CmdParts {\n head: string | null\n middle: CmdParts | null\n tail: string | null\n whole: string\n}\n\nfunction parseCmdStr(cmdStr: string): CmdParts {\n let parts = cmdStr.match(/^(.*?)\\{(.*)\\}(.*)$/) // TODO: lookbehinds for escape characters\n\n if (parts) {\n let middle = parseCmdStr(parts[2])\n\n return {\n head: parts[1],\n middle,\n tail: parts[3],\n whole: parts[1] + middle.whole + parts[3],\n }\n }\n\n return {\n head: null,\n middle: null,\n tail: null,\n whole: cmdStr,\n }\n}\n\nfunction formatRange(\n cmd: CmdParts,\n formatStart: (cmdStr: string) => string,\n formatEnd: (cmdStr: string) => string,\n separator: string,\n): string {\n if (cmd.middle) {\n let startHead = formatStart(cmd.head)\n let startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator)\n let startTail = formatStart(cmd.tail)\n\n let endHead = formatEnd(cmd.head)\n let endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator)\n let endTail = formatEnd(cmd.tail)\n\n if (startHead === endHead && startTail === endTail) {\n return startHead +\n (startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +\n startTail\n }\n }\n\n let startWhole = formatStart(cmd.whole)\n let endWhole = formatEnd(cmd.whole)\n\n if (startWhole === endWhole) {\n return startWhole\n }\n\n return startWhole + separator + endWhole\n}\n"],"names":[],"mappings":";;;;;;;;SAGgB,QAAQ,CAAC,IAAU,EAAE,QAAqB;IACxD,IAAI,EAAE,QAAQ,YAAY,WAAW,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;KACtD;
|
|
1
|
+
{"version":3,"file":"main.js","sources":["src/main.ts"],"sourcesContent":["import moment from 'moment'\nimport { Duration, VerboseFormattingArg, createPlugin, CalendarApi } from '@fullcalendar/common'\n\nexport function toMoment(date: Date, calendar: CalendarApi): moment.Moment {\n if (!(calendar instanceof CalendarApi)) {\n throw new Error('must supply a CalendarApi instance')\n }\n\n let { dateEnv } = calendar.getCurrentData()\n\n return convertToMoment(\n date,\n dateEnv.timeZone,\n null,\n dateEnv.locale.codes[0],\n )\n}\n\nexport function toMomentDuration(fcDuration: Duration): moment.Duration {\n return moment.duration(fcDuration) // moment accepts all the props that fc.Duration already has!\n}\n\nfunction formatWithCmdStr(cmdStr: string, arg: VerboseFormattingArg) {\n let cmd = parseCmdStr(cmdStr)\n\n if (arg.end) {\n let startMom = convertToMoment(\n arg.start.array,\n arg.timeZone,\n arg.start.timeZoneOffset,\n arg.localeCodes[0],\n )\n let endMom = convertToMoment(\n arg.end.array,\n arg.timeZone,\n arg.end.timeZoneOffset,\n arg.localeCodes[0],\n )\n return formatRange(\n cmd,\n createMomentFormatFunc(startMom),\n createMomentFormatFunc(endMom),\n arg.defaultSeparator,\n )\n }\n\n return convertToMoment(\n arg.date.array,\n arg.timeZone,\n arg.date.timeZoneOffset,\n arg.localeCodes[0],\n ).format(cmd.whole) // TODO: test for this\n}\n\nexport default createPlugin({\n cmdFormatter: formatWithCmdStr,\n})\n\nfunction createMomentFormatFunc(mom: moment.Moment) {\n return (cmdStr) => (\n cmdStr ? mom.format(cmdStr) : '' // because calling with blank string results in ISO8601 :(\n )\n}\n\nfunction convertToMoment(input: any, timeZone: string, timeZoneOffset: number | null, locale: string): moment.Moment {\n let mom: moment.Moment\n\n if (timeZone === 'local') {\n mom = moment(input)\n } else if (timeZone === 'UTC') {\n mom = moment.utc(input)\n } else if ((moment as any).tz) {\n mom = (moment as any).tz(input, timeZone)\n } else {\n mom = moment.utc(input)\n\n if (timeZoneOffset != null) {\n mom.utcOffset(timeZoneOffset)\n }\n }\n\n mom.locale(locale)\n\n return mom\n}\n\n/* Range Formatting (duplicate code as other date plugins)\n----------------------------------------------------------------------------------------------------*/\n\ninterface CmdParts {\n head: string | null\n middle: CmdParts | null\n tail: string | null\n whole: string\n}\n\nfunction parseCmdStr(cmdStr: string): CmdParts {\n let parts = cmdStr.match(/^(.*?)\\{(.*)\\}(.*)$/) // TODO: lookbehinds for escape characters\n\n if (parts) {\n let middle = parseCmdStr(parts[2])\n\n return {\n head: parts[1],\n middle,\n tail: parts[3],\n whole: parts[1] + middle.whole + parts[3],\n }\n }\n\n return {\n head: null,\n middle: null,\n tail: null,\n whole: cmdStr,\n }\n}\n\nfunction formatRange(\n cmd: CmdParts,\n formatStart: (cmdStr: string) => string,\n formatEnd: (cmdStr: string) => string,\n separator: string,\n): string {\n if (cmd.middle) {\n let startHead = formatStart(cmd.head)\n let startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator)\n let startTail = formatStart(cmd.tail)\n\n let endHead = formatEnd(cmd.head)\n let endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator)\n let endTail = formatEnd(cmd.tail)\n\n if (startHead === endHead && startTail === endTail) {\n return startHead +\n (startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +\n startTail\n }\n }\n\n let startWhole = formatStart(cmd.whole)\n let endWhole = formatEnd(cmd.whole)\n\n if (startWhole === endWhole) {\n return startWhole\n }\n\n return startWhole + separator + endWhole\n}\n"],"names":[],"mappings":";;;;;;;;SAGgB,QAAQ,CAAC,IAAU,EAAE,QAAqB;IACxD,IAAI,EAAE,QAAQ,YAAY,WAAW,CAAC,EAAE;QACtC,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAA;KACtD;IAED,IAAI,EAAE,OAAO,EAAE,GAAG,QAAQ,CAAC,cAAc,EAAE,CAAA;IAE3C,OAAO,eAAe,CACpB,IAAI,EACJ,OAAO,CAAC,QAAQ,EAChB,IAAI,EACJ,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CACxB,CAAA;AACH,CAAC;SAEe,gBAAgB,CAAC,UAAoB;IACnD,OAAO,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAA;AACpC,CAAC;AAED,SAAS,gBAAgB,CAAC,MAAc,EAAE,GAAyB;IACjE,IAAI,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,CAAA;IAE7B,IAAI,GAAG,CAAC,GAAG,EAAE;QACX,IAAI,QAAQ,GAAG,eAAe,CAC5B,GAAG,CAAC,KAAK,CAAC,KAAK,EACf,GAAG,CAAC,QAAQ,EACZ,GAAG,CAAC,KAAK,CAAC,cAAc,EACxB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CACnB,CAAA;QACD,IAAI,MAAM,GAAG,eAAe,CAC1B,GAAG,CAAC,GAAG,CAAC,KAAK,EACb,GAAG,CAAC,QAAQ,EACZ,GAAG,CAAC,GAAG,CAAC,cAAc,EACtB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CACnB,CAAA;QACD,OAAO,WAAW,CAChB,GAAG,EACH,sBAAsB,CAAC,QAAQ,CAAC,EAChC,sBAAsB,CAAC,MA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,GAAG,WAAW,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IACvC,IAAI,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;IAEnC,IAAI,UAAU,KAAK,QAAQ,EAAE;QAC3B,OAAO,UAAU,CAAA;KAClB;IAED,OAAO,UAAU,GAAG,SAAS,GAAG,QAAQ,CAAA;AAC1C;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/moment",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "6.0.0-beta.1",
|
|
4
4
|
"title": "FullCalendar Moment Plugin",
|
|
5
5
|
"description": "A connector to the MomentJS date library",
|
|
6
6
|
"docs": "https://fullcalendar.io/docs/moment-plugin",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@fullcalendar/common": "
|
|
8
|
+
"@fullcalendar/common": "6.0.0-beta.1",
|
|
9
9
|
"tslib": "^2.1.0"
|
|
10
10
|
},
|
|
11
11
|
"peerDependencies": {
|
|
12
12
|
"moment": "^2.29.1"
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@fullcalendar/core-preact": "
|
|
15
|
+
"@fullcalendar/core-preact": "6.0.0-beta.1",
|
|
16
16
|
"moment": "^2.29.1"
|
|
17
17
|
},
|
|
18
18
|
"main": "main.cjs.js",
|