aboutsummaryrefslogtreecommitdiffstats
path: root/library/fullcalendar/packages/moment
diff options
context:
space:
mode:
Diffstat (limited to 'library/fullcalendar/packages/moment')
-rw-r--r--library/fullcalendar/packages/moment/LICENSE.txt20
-rw-r--r--library/fullcalendar/packages/moment/README.md8
-rw-r--r--library/fullcalendar/packages/moment/main.d.ts14
-rw-r--r--library/fullcalendar/packages/moment/main.esm.js102
-rw-r--r--library/fullcalendar/packages/moment/main.js19
-rw-r--r--library/fullcalendar/packages/moment/main.min.js4
-rw-r--r--library/fullcalendar/packages/moment/package.json34
7 files changed, 193 insertions, 8 deletions
diff --git a/library/fullcalendar/packages/moment/LICENSE.txt b/library/fullcalendar/packages/moment/LICENSE.txt
new file mode 100644
index 000000000..2149cfbef
--- /dev/null
+++ b/library/fullcalendar/packages/moment/LICENSE.txt
@@ -0,0 +1,20 @@
+Copyright (c) 2019 Adam Shaw
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
diff --git a/library/fullcalendar/packages/moment/README.md b/library/fullcalendar/packages/moment/README.md
new file mode 100644
index 000000000..854e4367f
--- /dev/null
+++ b/library/fullcalendar/packages/moment/README.md
@@ -0,0 +1,8 @@
+
+# FullCalendar Moment Plugin
+
+A connector to the MomentJS date library
+
+[View the docs »](https://fullcalendar.io/docs/moment-plugins)
+
+This package was created from the [FullCalendar monorepo »](https://github.com/fullcalendar/fullcalendar)
diff --git a/library/fullcalendar/packages/moment/main.d.ts b/library/fullcalendar/packages/moment/main.d.ts
new file mode 100644
index 000000000..cc81dab62
--- /dev/null
+++ b/library/fullcalendar/packages/moment/main.d.ts
@@ -0,0 +1,14 @@
+// Generated by dts-bundle v0.7.3-fork.1
+// Dependencies for this module:
+// ../../../../../moment
+// ../../../../../@fullcalendar/core
+
+declare module '@fullcalendar/moment' {
+ import * as momentNs from 'moment';
+ import { Calendar, Duration } from '@fullcalendar/core';
+ export function toMoment(date: Date, calendar: Calendar): momentNs.Moment;
+ export function toDuration(fcDuration: Duration): momentNs.Duration;
+ const _default: import("@fullcalendar/core").PluginDef;
+ export default _default;
+}
+
diff --git a/library/fullcalendar/packages/moment/main.esm.js b/library/fullcalendar/packages/moment/main.esm.js
new file mode 100644
index 000000000..fb97563f3
--- /dev/null
+++ b/library/fullcalendar/packages/moment/main.esm.js
@@ -0,0 +1,102 @@
+/*!
+FullCalendar Moment Plugin v4.4.2
+Docs & License: https://fullcalendar.io/
+(c) 2019 Adam Shaw
+*/
+
+import * as momentNs from 'moment';
+import { createPlugin, Calendar } from '@fullcalendar/core';
+
+var moment = momentNs; // the directly callable function
+function toMoment(date, calendar) {
+ if (!(calendar instanceof Calendar)) {
+ throw new Error('must supply a Calendar instance');
+ }
+ return convertToMoment(date, calendar.dateEnv.timeZone, null, calendar.dateEnv.locale.codes[0]);
+}
+function toDuration(fcDuration) {
+ return moment.duration(fcDuration); // moment accepts all the props that fc.Duration already has!
+}
+function formatWithCmdStr(cmdStr, arg) {
+ var cmd = parseCmdStr(cmdStr);
+ if (arg.end) {
+ var startMom = convertToMoment(arg.start.array, arg.timeZone, arg.start.timeZoneOffset, arg.localeCodes[0]);
+ var endMom = convertToMoment(arg.end.array, arg.timeZone, arg.end.timeZoneOffset, arg.localeCodes[0]);
+ return formatRange(cmd, createMomentFormatFunc(startMom), createMomentFormatFunc(endMom), arg.separator);
+ }
+ return convertToMoment(arg.date.array, arg.timeZone, arg.date.timeZoneOffset, arg.localeCodes[0]).format(cmd.whole); // TODO: test for this
+}
+var main = createPlugin({
+ cmdFormatter: formatWithCmdStr
+});
+function createMomentFormatFunc(mom) {
+ return function (cmdStr) {
+ return cmdStr ? mom.format(cmdStr) : ''; // because calling with blank string results in ISO8601 :(
+ };
+}
+function convertToMoment(input, timeZone, timeZoneOffset, locale) {
+ var mom;
+ if (timeZone === 'local') {
+ mom = moment(input);
+ }
+ else if (timeZone === 'UTC') {
+ mom = moment.utc(input);
+ }
+ else if (moment.tz) {
+ mom = moment.tz(input, timeZone);
+ }
+ else {
+ mom = moment.utc(input);
+ if (timeZoneOffset != null) {
+ mom.utcOffset(timeZoneOffset);
+ }
+ }
+ mom.locale(locale);
+ return mom;
+}
+function parseCmdStr(cmdStr) {
+ var parts = cmdStr.match(/^(.*?)\{(.*)\}(.*)$/); // TODO: lookbehinds for escape characters
+ if (parts) {
+ var middle = parseCmdStr(parts[2]);
+ return {
+ head: parts[1],
+ middle: middle,
+ tail: parts[3],
+ whole: parts[1] + middle.whole + parts[3]
+ };
+ }
+ else {
+ return {
+ head: null,
+ middle: null,
+ tail: null,
+ whole: cmdStr
+ };
+ }
+}
+function formatRange(cmd, formatStart, formatEnd, separator) {
+ if (cmd.middle) {
+ var startHead = formatStart(cmd.head);
+ var startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
+ var startTail = formatStart(cmd.tail);
+ var endHead = formatEnd(cmd.head);
+ var endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
+ var endTail = formatEnd(cmd.tail);
+ if (startHead === endHead && startTail === endTail) {
+ return startHead +
+ (startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +
+ startTail;
+ }
+ }
+ var startWhole = formatStart(cmd.whole);
+ var endWhole = formatEnd(cmd.whole);
+ if (startWhole === endWhole) {
+ return startWhole;
+ }
+ else {
+ return startWhole + separator + endWhole;
+ }
+}
+
+export default main;
+export { toDuration, toMoment };
diff --git a/library/fullcalendar/packages/moment/main.js b/library/fullcalendar/packages/moment/main.js
index ca94518a4..794bee900 100644
--- a/library/fullcalendar/packages/moment/main.js
+++ b/library/fullcalendar/packages/moment/main.js
@@ -1,16 +1,16 @@
/*!
-FullCalendar Moment Plugin v4.0.2
+FullCalendar Moment Plugin v4.4.2
Docs & License: https://fullcalendar.io/
(c) 2019 Adam Shaw
*/
+
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('moment'), require('@fullcalendar/core')) :
typeof define === 'function' && define.amd ? define(['exports', 'moment', '@fullcalendar/core'], factory) :
(global = global || self, factory(global.FullCalendarMoment = {}, global.moment, global.FullCalendar));
-}(this, function (exports, moment, core) { 'use strict';
-
- moment = moment && moment.hasOwnProperty('default') ? moment['default'] : moment;
+}(this, function (exports, momentNs, core) { 'use strict';
+ var moment = momentNs; // the directly callable function
function toMoment(date, calendar) {
if (!(calendar instanceof core.Calendar)) {
throw new Error('must supply a Calendar instance');
@@ -18,7 +18,7 @@ Docs & License: https://fullcalendar.io/
return convertToMoment(date, calendar.dateEnv.timeZone, null, calendar.dateEnv.locale.codes[0]);
}
function toDuration(fcDuration) {
- return moment.duration(fcDuration); // momment accepts all the props that fc.Duration already has!
+ return moment.duration(fcDuration); // moment accepts all the props that fc.Duration already has!
}
function formatWithCmdStr(cmdStr, arg) {
var cmd = parseCmdStr(cmdStr);
@@ -91,7 +91,14 @@ Docs & License: https://fullcalendar.io/
startTail;
}
}
- return formatStart(cmd.whole) + separator + formatEnd(cmd.whole);
+ var startWhole = formatStart(cmd.whole);
+ var endWhole = formatEnd(cmd.whole);
+ if (startWhole === endWhole) {
+ return startWhole;
+ }
+ else {
+ return startWhole + separator + endWhole;
+ }
}
exports.default = main;
diff --git a/library/fullcalendar/packages/moment/main.min.js b/library/fullcalendar/packages/moment/main.min.js
index 9b5b6d84e..39552c279 100644
--- a/library/fullcalendar/packages/moment/main.min.js
+++ b/library/fullcalendar/packages/moment/main.min.js
@@ -1,6 +1,6 @@
/*!
-FullCalendar Moment Plugin v4.0.2
+FullCalendar Moment Plugin v4.4.2
Docs & License: https://fullcalendar.io/
(c) 2019 Adam Shaw
*/
-!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("moment"),require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","moment","@fullcalendar/core"],t):(e=e||self,t(e.FullCalendarMoment={},e.moment,e.FullCalendar))}(this,function(e,t,n){"use strict";function r(e,t){if(!(t instanceof n.Calendar))throw new Error("must supply a Calendar instance");return u(e,t.dateEnv.timeZone,null,t.dateEnv.locale.codes[0])}function a(e){return t.duration(e)}function o(e,t){var n=i(e);if(t.end){var r=u(t.start.array,t.timeZone,t.start.timeZoneOffset,t.localeCodes[0]),a=u(t.end.array,t.timeZone,t.end.timeZoneOffset,t.localeCodes[0]);return d(n,l(r),l(a),t.separator)}return u(t.date.array,t.timeZone,t.date.timeZoneOffset,t.localeCodes[0]).format(n.whole)}function l(e){return function(t){return t?e.format(t):""}}function u(e,n,r,a){var o;return"local"===n?o=t(e):"UTC"===n?o=t.utc(e):t.tz?o=t.tz(e,n):(o=t.utc(e),null!=r&&o.utcOffset(r)),o.locale(a),o}function i(e){var t=e.match(/^(.*?)\{(.*)\}(.*)$/);if(t){var n=i(t[2]);return{head:t[1],middle:n,tail:t[3],whole:t[1]+n.whole+t[3]}}return{head:null,middle:null,tail:null,whole:e}}function d(e,t,n,r){if(e.middle){var a=t(e.head),o=d(e.middle,t,n,r),l=t(e.tail),u=n(e.head),i=d(e.middle,t,n,r),f=n(e.tail);if(a===u&&l===f)return a+(o===i?o:o+r+i)+l}return t(e.whole)+r+n(e.whole)}t=t&&t.hasOwnProperty("default")?t.default:t;var f=n.createPlugin({cmdFormatter:o});e.default=f,e.toDuration=a,e.toMoment=r,Object.defineProperty(e,"__esModule",{value:!0})}); \ No newline at end of file
+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("moment"),require("@fullcalendar/core")):"function"==typeof define&&define.amd?define(["exports","moment","@fullcalendar/core"],t):t((e=e||self).FullCalendarMoment={},e.moment,e.FullCalendar)}(this,(function(e,t,n){"use strict";var r=t;var a=n.createPlugin({cmdFormatter:function(e,t){var n=function e(t){var n=t.match(/^(.*?)\{(.*)\}(.*)$/);if(n){var r=e(n[2]);return{head:n[1],middle:r,tail:n[3],whole:n[1]+r.whole+n[3]}}return{head:null,middle:null,tail:null,whole:t}}(e);if(t.end){var r=l(t.start.array,t.timeZone,t.start.timeZoneOffset,t.localeCodes[0]),a=l(t.end.array,t.timeZone,t.end.timeZoneOffset,t.localeCodes[0]);return function e(t,n,r,a){if(t.middle){var o=n(t.head),l=e(t.middle,n,r,a),u=n(t.tail),i=r(t.head),d=e(t.middle,n,r,a),f=r(t.tail);if(o===i&&u===f)return o+(l===d?l:l+a+d)+u}var c=n(t.whole),m=r(t.whole);return c===m?c:c+a+m}(n,o(r),o(a),t.separator)}return l(t.date.array,t.timeZone,t.date.timeZoneOffset,t.localeCodes[0]).format(n.whole)}});function o(e){return function(t){return t?e.format(t):""}}function l(e,t,n,a){var o;return"local"===t?o=r(e):"UTC"===t?o=r.utc(e):r.tz?o=r.tz(e,t):(o=r.utc(e),null!=n&&o.utcOffset(n)),o.locale(a),o}e.default=a,e.toDuration=function(e){return r.duration(e)},e.toMoment=function(e,t){if(!(t instanceof n.Calendar))throw new Error("must supply a Calendar instance");return l(e,t.dateEnv.timeZone,null,t.dateEnv.locale.codes[0])},Object.defineProperty(e,"__esModule",{value:!0})})); \ No newline at end of file
diff --git a/library/fullcalendar/packages/moment/package.json b/library/fullcalendar/packages/moment/package.json
new file mode 100644
index 000000000..d7571f312
--- /dev/null
+++ b/library/fullcalendar/packages/moment/package.json
@@ -0,0 +1,34 @@
+{
+ "name": "@fullcalendar/moment",
+ "version": "4.4.2",
+ "title": "FullCalendar Moment Plugin",
+ "description": "A connector to the MomentJS date library",
+ "keywords": [
+ "calendar",
+ "event",
+ "full-sized"
+ ],
+ "homepage": "https://fullcalendar.io/",
+ "docs": "https://fullcalendar.io/docs/moment-plugins",
+ "bugs": "https://fullcalendar.io/reporting-bugs",
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/fullcalendar/fullcalendar.git",
+ "homepage": "https://github.com/fullcalendar/fullcalendar"
+ },
+ "license": "MIT",
+ "author": {
+ "name": "Adam Shaw",
+ "email": "arshaw@arshaw.com",
+ "url": "http://arshaw.com/"
+ },
+ "copyright": "2019 Adam Shaw",
+ "peerDependencies": {
+ "@fullcalendar/core": "~4.4.0",
+ "moment": "^2.24.0"
+ },
+ "main": "main.js",
+ "module": "main.esm.js",
+ "unpkg": "main.min.js",
+ "types": "main.d.ts"
+}