@fullcalendar/moment 6.0.1 → 6.0.3
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.cjs → index.esm.js} +12 -22
- package/index.global.js +1 -1
- package/index.global.min.js +1 -1
- package/index.js +22 -12
- package/package.json +6 -8
|
@@ -1,39 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
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);
|
|
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/index.global.js
CHANGED
package/index.global.min.js
CHANGED
package/index.js
CHANGED
|
@@ -1,31 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
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);
|
|
4
12
|
|
|
5
13
|
function toMoment(date, calendar) {
|
|
6
|
-
if (!(calendar instanceof CalendarImpl)) {
|
|
14
|
+
if (!(calendar instanceof internal.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 = core.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fullcalendar/moment",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.3",
|
|
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.0.
|
|
15
|
+
"@fullcalendar/core": "~6.0.3",
|
|
16
16
|
"moment": "^2.29.1"
|
|
17
17
|
},
|
|
18
18
|
"type": "module",
|
|
@@ -29,19 +29,17 @@
|
|
|
29
29
|
"url": "http://arshaw.com/"
|
|
30
30
|
},
|
|
31
31
|
"copyright": "2022 Adam Shaw",
|
|
32
|
-
"main": "./index.cjs",
|
|
33
|
-
"module": "./index.js",
|
|
34
32
|
"types": "./index.d.ts",
|
|
33
|
+
"main": "./index.js",
|
|
34
|
+
"module": "./index.esm.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",
|
|
40
|
-
"./index.js": "./index.js",
|
|
41
39
|
".": {
|
|
42
40
|
"types": "./index.d.ts",
|
|
43
|
-
"require": "./index.
|
|
44
|
-
"import": "./index.js"
|
|
41
|
+
"require": "./index.js",
|
|
42
|
+
"import": "./index.esm.js"
|
|
45
43
|
}
|
|
46
44
|
},
|
|
47
45
|
"sideEffects": false
|