@fullcalendar/moment 6.1.0 → 6.1.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/{index.esm.js → index.cjs} +22 -12
- package/index.global.js +2 -2
- package/index.global.min.js +2 -2
- package/index.js +12 -22
- package/package.json +8 -7
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var index_cjs = require('@fullcalendar/core/index.cjs');
|
|
6
|
+
var moment = require('moment');
|
|
7
|
+
var internal_cjs = require('@fullcalendar/core/internal.cjs');
|
|
8
|
+
|
|
9
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
+
|
|
11
|
+
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
4
12
|
|
|
5
13
|
function toMoment(date, calendar) {
|
|
6
|
-
if (!(calendar instanceof CalendarImpl)) {
|
|
14
|
+
if (!(calendar instanceof internal_cjs.CalendarImpl)) {
|
|
7
15
|
throw new Error('must supply a CalendarApi instance');
|
|
8
16
|
}
|
|
9
17
|
let { dateEnv } = calendar.getCurrentData();
|
|
10
18
|
return convertToMoment(date, dateEnv.timeZone, null, dateEnv.locale.codes[0]);
|
|
11
19
|
}
|
|
12
20
|
function toMomentDuration(fcDuration) {
|
|
13
|
-
return
|
|
21
|
+
return moment__default["default"].duration(fcDuration); // moment accepts all the props that fc.Duration already has!
|
|
14
22
|
}
|
|
15
23
|
// Internal Utils
|
|
16
24
|
function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
|
17
25
|
let mom;
|
|
18
26
|
if (timeZone === 'local') {
|
|
19
|
-
mom =
|
|
27
|
+
mom = moment__default["default"](input);
|
|
20
28
|
}
|
|
21
29
|
else if (timeZone === 'UTC') {
|
|
22
|
-
mom =
|
|
30
|
+
mom = moment__default["default"].utc(input);
|
|
23
31
|
}
|
|
24
|
-
else if (
|
|
25
|
-
mom =
|
|
32
|
+
else if (moment__default["default"].tz) {
|
|
33
|
+
mom = moment__default["default"].tz(input, timeZone);
|
|
26
34
|
}
|
|
27
35
|
else {
|
|
28
|
-
mom =
|
|
36
|
+
mom = moment__default["default"].utc(input);
|
|
29
37
|
if (timeZoneOffset != null) {
|
|
30
38
|
mom.utcOffset(timeZoneOffset);
|
|
31
39
|
}
|
|
@@ -87,9 +95,11 @@ function formatRange(cmd, formatStart, formatEnd, separator) {
|
|
|
87
95
|
return startWhole + separator + endWhole;
|
|
88
96
|
}
|
|
89
97
|
|
|
90
|
-
var index = createPlugin({
|
|
98
|
+
var index = index_cjs.createPlugin({
|
|
91
99
|
name: '@fullcalendar/moment',
|
|
92
100
|
cmdFormatter: formatWithCmdStr,
|
|
93
101
|
});
|
|
94
102
|
|
|
95
|
-
|
|
103
|
+
exports["default"] = index;
|
|
104
|
+
exports.toMoment = toMoment;
|
|
105
|
+
exports.toMomentDuration = toMomentDuration;
|
package/index.global.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Moment Plugin v6.1.
|
|
2
|
+
FullCalendar Moment Plugin v6.1.1
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/moment-plugin
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2023 Adam Shaw
|
|
5
5
|
*/
|
|
6
6
|
FullCalendar.Moment = (function (exports, core, moment, internal) {
|
|
7
7
|
'use strict';
|
package/index.global.min.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
FullCalendar Moment Plugin v6.1.
|
|
2
|
+
FullCalendar Moment Plugin v6.1.1
|
|
3
3
|
Docs & License: https://fullcalendar.io/docs/moment-plugin
|
|
4
|
-
(c)
|
|
4
|
+
(c) 2023 Adam Shaw
|
|
5
5
|
*/
|
|
6
6
|
FullCalendar.Moment=function(e,t,l,n){"use strict";function a(e){return e&&e.__esModule?e:{default:e}}var r=a(l);function u(e,t,l,n){let a;return"local"===t?a=r.default(e):"UTC"===t?a=r.default.utc(e):r.default.tz?a=r.default.tz(e,t):(a=r.default.utc(e),null!=l&&a.utcOffset(l)),a.locale(n),a}function o(e){return t=>t?e.format(t):""}var d=t.createPlugin({name:"@fullcalendar/moment",cmdFormatter:function(e,t){let l=function e(t){let l=t.match(/^(.*?)\{(.*)\}(.*)$/);if(l){let t=e(l[2]);return{head:l[1],middle:t,tail:l[3],whole:l[1]+t.whole+l[3]}}return{head:null,middle:null,tail:null,whole:t}}(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 function e(t,l,n,a){if(t.middle){let r=l(t.head),u=e(t.middle,l,n,a),o=l(t.tail),d=n(t.head),i=e(t.middle,l,n,a),f=n(t.tail);if(r===d&&o===f)return r+(u===i?u:u+a+i)+o}let r=l(t.whole),u=n(t.whole);if(r===u)return r;return r+a+u}(l,o(e),o(n),t.defaultSeparator)}return u(t.date.array,t.timeZone,t.date.timeZoneOffset,t.localeCodes[0]).format(l.whole)}});return t.globalPlugins.push(d),e.default=d,e.toMoment=function(e,t){if(!(t instanceof n.CalendarImpl))throw new Error("must supply a CalendarApi instance");let{dateEnv:l}=t.getCurrentData();return u(e,l.timeZone,null,l.locale.codes[0])},e.toMomentDuration=function(e){return r.default.duration(e)},Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,moment,FullCalendar.Internal);
|
package/index.js
CHANGED
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var core = require('@fullcalendar/core');
|
|
6
|
-
var moment = require('moment');
|
|
7
|
-
var internal = require('@fullcalendar/core/internal');
|
|
8
|
-
|
|
9
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
10
|
-
|
|
11
|
-
var moment__default = /*#__PURE__*/_interopDefaultLegacy(moment);
|
|
1
|
+
import { createPlugin } from '@fullcalendar/core';
|
|
2
|
+
import moment from 'moment';
|
|
3
|
+
import { CalendarImpl } from '@fullcalendar/core/internal';
|
|
12
4
|
|
|
13
5
|
function toMoment(date, calendar) {
|
|
14
|
-
if (!(calendar instanceof
|
|
6
|
+
if (!(calendar instanceof CalendarImpl)) {
|
|
15
7
|
throw new Error('must supply a CalendarApi instance');
|
|
16
8
|
}
|
|
17
9
|
let { dateEnv } = calendar.getCurrentData();
|
|
18
10
|
return convertToMoment(date, dateEnv.timeZone, null, dateEnv.locale.codes[0]);
|
|
19
11
|
}
|
|
20
12
|
function toMomentDuration(fcDuration) {
|
|
21
|
-
return
|
|
13
|
+
return moment.duration(fcDuration); // moment accepts all the props that fc.Duration already has!
|
|
22
14
|
}
|
|
23
15
|
// Internal Utils
|
|
24
16
|
function convertToMoment(input, timeZone, timeZoneOffset, locale) {
|
|
25
17
|
let mom;
|
|
26
18
|
if (timeZone === 'local') {
|
|
27
|
-
mom =
|
|
19
|
+
mom = moment(input);
|
|
28
20
|
}
|
|
29
21
|
else if (timeZone === 'UTC') {
|
|
30
|
-
mom =
|
|
22
|
+
mom = moment.utc(input);
|
|
31
23
|
}
|
|
32
|
-
else if (
|
|
33
|
-
mom =
|
|
24
|
+
else if (moment.tz) {
|
|
25
|
+
mom = moment.tz(input, timeZone);
|
|
34
26
|
}
|
|
35
27
|
else {
|
|
36
|
-
mom =
|
|
28
|
+
mom = moment.utc(input);
|
|
37
29
|
if (timeZoneOffset != null) {
|
|
38
30
|
mom.utcOffset(timeZoneOffset);
|
|
39
31
|
}
|
|
@@ -95,11 +87,9 @@ function formatRange(cmd, formatStart, formatEnd, separator) {
|
|
|
95
87
|
return startWhole + separator + endWhole;
|
|
96
88
|
}
|
|
97
89
|
|
|
98
|
-
var index =
|
|
90
|
+
var index = createPlugin({
|
|
99
91
|
name: '@fullcalendar/moment',
|
|
100
92
|
cmdFormatter: formatWithCmdStr,
|
|
101
93
|
});
|
|
102
94
|
|
|
103
|
-
|
|
104
|
-
exports.toMoment = toMoment;
|
|
105
|
-
exports.toMomentDuration = toMomentDuration;
|
|
95
|
+
export { index as default, toMoment, toMomentDuration };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/moment",
|
|
3
|
-
"version": "6.1.
|
|
3
|
+
"version": "6.1.1",
|
|
4
4
|
"title": "FullCalendar Moment Plugin",
|
|
5
5
|
"description": "Enhanced date formatting and conversion with Moment",
|
|
6
6
|
"keywords": [
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
],
|
|
13
13
|
"homepage": "https://fullcalendar.io/docs/moment-plugin",
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@fullcalendar/core": "~6.1.
|
|
15
|
+
"@fullcalendar/core": "~6.1.1",
|
|
16
16
|
"moment": "^2.29.1"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
@@ -28,18 +28,19 @@
|
|
|
28
28
|
"email": "arshaw@arshaw.com",
|
|
29
29
|
"url": "http://arshaw.com/"
|
|
30
30
|
},
|
|
31
|
-
"copyright": "
|
|
31
|
+
"copyright": "2023 Adam Shaw",
|
|
32
32
|
"types": "./index.d.ts",
|
|
33
|
-
"main": "./index.
|
|
34
|
-
"module": "./index.
|
|
33
|
+
"main": "./index.cjs",
|
|
34
|
+
"module": "./index.js",
|
|
35
35
|
"unpkg": "./index.global.min.js",
|
|
36
36
|
"jsdelivr": "./index.global.min.js",
|
|
37
37
|
"exports": {
|
|
38
38
|
"./package.json": "./package.json",
|
|
39
|
+
"./index.cjs": "./index.cjs",
|
|
39
40
|
".": {
|
|
40
41
|
"types": "./index.d.ts",
|
|
41
|
-
"require": "./index.
|
|
42
|
-
"import": "./index.
|
|
42
|
+
"require": "./index.cjs",
|
|
43
|
+
"import": "./index.js"
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"sideEffects": false
|