aboutsummaryrefslogtreecommitdiffstats
path: root/library/fullcalendar/packages/moment
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2023-01-25 13:09:00 +0000
committerMario <mario@mariovavti.com>2023-01-25 13:09:00 +0000
commita9ae17036d30a676c833a6ddb98409f19cbbd963 (patch)
tree66d29806350386a585dcbf4aa20f51cda4da6c49 /library/fullcalendar/packages/moment
parent08e925758e920b898ac2d08710eab2f9638fe276 (diff)
downloadvolse-hubzilla-a9ae17036d30a676c833a6ddb98409f19cbbd963.tar.gz
volse-hubzilla-a9ae17036d30a676c833a6ddb98409f19cbbd963.tar.bz2
volse-hubzilla-a9ae17036d30a676c833a6ddb98409f19cbbd963.zip
update fullcalendar
Diffstat (limited to 'library/fullcalendar/packages/moment')
-rw-r--r--library/fullcalendar/packages/moment/index.global.js113
-rw-r--r--library/fullcalendar/packages/moment/index.global.min.js6
2 files changed, 119 insertions, 0 deletions
diff --git a/library/fullcalendar/packages/moment/index.global.js b/library/fullcalendar/packages/moment/index.global.js
new file mode 100644
index 000000000..f06c85200
--- /dev/null
+++ b/library/fullcalendar/packages/moment/index.global.js
@@ -0,0 +1,113 @@
+/*!
+FullCalendar Moment Plugin v6.0.3
+Docs & License: https://fullcalendar.io/docs/moment-plugin
+(c) 2022 Adam Shaw
+*/
+FullCalendar.Moment = (function (exports, core, moment, internal) {
+ 'use strict';
+
+ function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
+
+ var moment__default = /*#__PURE__*/_interopDefault(moment);
+
+ function toMoment(date, calendar) {
+ if (!(calendar instanceof internal.CalendarImpl)) {
+ throw new Error('must supply a CalendarApi instance');
+ }
+ let { dateEnv } = calendar.getCurrentData();
+ return convertToMoment(date, dateEnv.timeZone, null, dateEnv.locale.codes[0]);
+ }
+ function toMomentDuration(fcDuration) {
+ return moment__default["default"].duration(fcDuration); // moment accepts all the props that fc.Duration already has!
+ }
+ // Internal Utils
+ function convertToMoment(input, timeZone, timeZoneOffset, locale) {
+ let mom;
+ if (timeZone === 'local') {
+ mom = moment__default["default"](input);
+ }
+ else if (timeZone === 'UTC') {
+ mom = moment__default["default"].utc(input);
+ }
+ else if (moment__default["default"].tz) {
+ mom = moment__default["default"].tz(input, timeZone);
+ }
+ else {
+ mom = moment__default["default"].utc(input);
+ if (timeZoneOffset != null) {
+ mom.utcOffset(timeZoneOffset);
+ }
+ }
+ mom.locale(locale);
+ return mom;
+ }
+
+ function formatWithCmdStr(cmdStr, arg) {
+ let cmd = parseCmdStr(cmdStr);
+ if (arg.end) {
+ let startMom = convertToMoment(arg.start.array, arg.timeZone, arg.start.timeZoneOffset, arg.localeCodes[0]);
+ let endMom = convertToMoment(arg.end.array, arg.timeZone, arg.end.timeZoneOffset, arg.localeCodes[0]);
+ return formatRange(cmd, createMomentFormatFunc(startMom), createMomentFormatFunc(endMom), arg.defaultSeparator);
+ }
+ return convertToMoment(arg.date.array, arg.timeZone, arg.date.timeZoneOffset, arg.localeCodes[0]).format(cmd.whole); // TODO: test for this
+ }
+ function createMomentFormatFunc(mom) {
+ return (cmdStr) => (cmdStr ? mom.format(cmdStr) : '' // because calling with blank string results in ISO8601 :(
+ );
+ }
+ function parseCmdStr(cmdStr) {
+ let parts = cmdStr.match(/^(.*?)\{(.*)\}(.*)$/); // TODO: lookbehinds for escape characters
+ if (parts) {
+ let middle = parseCmdStr(parts[2]);
+ return {
+ head: parts[1],
+ middle,
+ tail: parts[3],
+ whole: parts[1] + middle.whole + parts[3],
+ };
+ }
+ return {
+ head: null,
+ middle: null,
+ tail: null,
+ whole: cmdStr,
+ };
+ }
+ function formatRange(cmd, formatStart, formatEnd, separator) {
+ if (cmd.middle) {
+ let startHead = formatStart(cmd.head);
+ let startMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
+ let startTail = formatStart(cmd.tail);
+ let endHead = formatEnd(cmd.head);
+ let endMiddle = formatRange(cmd.middle, formatStart, formatEnd, separator);
+ let endTail = formatEnd(cmd.tail);
+ if (startHead === endHead && startTail === endTail) {
+ return startHead +
+ (startMiddle === endMiddle ? startMiddle : startMiddle + separator + endMiddle) +
+ startTail;
+ }
+ }
+ let startWhole = formatStart(cmd.whole);
+ let endWhole = formatEnd(cmd.whole);
+ if (startWhole === endWhole) {
+ return startWhole;
+ }
+ return startWhole + separator + endWhole;
+ }
+
+ var plugin = core.createPlugin({
+ name: '@fullcalendar/moment',
+ cmdFormatter: formatWithCmdStr,
+ });
+
+ core.globalPlugins.push(plugin);
+
+ exports["default"] = plugin;
+ exports.toMoment = toMoment;
+ exports.toMomentDuration = toMomentDuration;
+
+ Object.defineProperty(exports, '__esModule', { value: true });
+
+ return exports;
+
+})({}, FullCalendar, moment, FullCalendar.Internal);
diff --git a/library/fullcalendar/packages/moment/index.global.min.js b/library/fullcalendar/packages/moment/index.global.min.js
new file mode 100644
index 000000000..438c642f3
--- /dev/null
+++ b/library/fullcalendar/packages/moment/index.global.min.js
@@ -0,0 +1,6 @@
+/*!
+FullCalendar Moment Plugin v6.0.3
+Docs & License: https://fullcalendar.io/docs/moment-plugin
+(c) 2022 Adam Shaw
+*/
+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); \ No newline at end of file