New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@fullcalendar/rrule

Package Overview
Dependencies
Maintainers
1
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fullcalendar/rrule - npm Package Compare versions

Comparing version 5.4.0 to 5.5.0

149

main.cjs.js
/*!
FullCalendar v5.3.2
FullCalendar v5.5.0
Docs & License: https://fullcalendar.io/

@@ -16,2 +16,4 @@ (c) 2020 Adam Shaw

rrule: common.identity,
exrule: common.identity,
exdate: common.identity,
duration: common.createDuration,

@@ -21,10 +23,10 @@ };

var recurring = {
parse: function (refined, dateEnv) {
if (refined.rrule != null) {
var parsed = parseRRule(refined.rrule, dateEnv);
if (parsed) {
parse: function (eventProps, dateEnv) {
if (eventProps.rrule != null) {
var eventRRuleData = parseEventRRule(eventProps, dateEnv);
if (eventRRuleData) {
return {
typeData: { rrule: parsed.rrule, isTimeZoneSpecified: parsed.isTimeZoneSpecified },
allDayGuess: !parsed.isTimeSpecified,
duration: refined.duration,
typeData: { rruleSet: eventRRuleData.rruleSet, isTimeZoneSpecified: eventRRuleData.isTimeZoneSpecified },
allDayGuess: !eventRRuleData.isTimeSpecified,
duration: eventProps.duration,
};

@@ -35,11 +37,14 @@ }

},
expand: function (parsed, framingRange, dateEnv) {
var dates = parsed.rrule.between(framingRange.start, framingRange.end, true); // always UTC
if (parsed.isTimeZoneSpecified) { // not already in DateMarker form
dates = dates.map(function (date) { return dateEnv.createMarker(date); });
expand: function (eventRRuleData, framingRange, dateEnv) {
var dates;
if (eventRRuleData.isTimeZoneSpecified) {
dates = eventRRuleData.rruleSet.between(dateEnv.toDate(framingRange.start), // rrule lib will treat as UTC-zoned
dateEnv.toDate(framingRange.end), // (same)
true).map(function (date) { return dateEnv.createMarker(date); }); // convert UTC-zoned-date to locale datemarker
}
// we WANT an inclusive start and in exclusive end, but the js rrule lib will only do either BOTH
// inclusive or BOTH exclusive, which is stupid: https://github.com/jakubroztocil/rrule/issues/84
// Workaround: make inclusive, which will generate extra occurences, and then trim.
dates = dates.filter(function (date) { return date.valueOf() < framingRange.end.valueOf(); });
else {
// when no timezone in given start/end, the rrule lib will assume UTC,
// which is same as our DateMarkers. no need to manipulate
dates = eventRRuleData.rruleSet.between(framingRange.start, framingRange.end, true);
}
return dates;

@@ -52,62 +57,68 @@ },

});
function parseRRule(input, dateEnv) {
function parseEventRRule(eventProps, dateEnv) {
var rruleSet;
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
var rrule$1;
if (typeof input === 'string') {
rrule$1 = rrule.rrulestr(input);
var result = analyzeRRuleString(input);
isTimeSpecified = result.isTimeSpecified;
isTimeZoneSpecified = result.isTimeZoneSpecified;
if (typeof eventProps.rrule === 'string') {
var res = parseRRuleString(eventProps.rrule);
rruleSet = res.rruleSet;
isTimeSpecified = res.isTimeSpecified;
isTimeZoneSpecified = res.isTimeZoneSpecified;
}
else if (typeof input === 'object' && input) { // non-null object
var refined = tslib.__assign({}, input); // copy
if (typeof refined.dtstart === 'string') {
var result = common.parseMarker(refined.dtstart);
// TODO: not DRY
if (result) {
isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || result.timeZoneOffset !== null;
refined.dtstart = new Date(result.marker.valueOf() - (result.timeZoneOffset || 0) * 60 * 1000);
if (typeof eventProps.rrule === 'object' && eventProps.rrule) { // non-null object
var res = parseRRuleObject(eventProps.rrule, dateEnv);
rruleSet = new rrule.RRuleSet();
rruleSet.rrule(res.rrule);
isTimeSpecified = res.isTimeSpecified;
isTimeZoneSpecified = res.isTimeZoneSpecified;
}
// convery to arrays. TODO: general util?
var exdateInputs = [].concat(eventProps.exdate || []);
var exruleInputs = [].concat(eventProps.exrule || []);
for (var _i = 0, exdateInputs_1 = exdateInputs; _i < exdateInputs_1.length; _i++) {
var exdateInput = exdateInputs_1[_i];
var res = common.parseMarker(exdateInput);
isTimeSpecified = isTimeSpecified || !res.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || res.timeZoneOffset !== null;
rruleSet.exdate(new Date(res.marker.valueOf() - (res.timeZoneOffset || 0) * 60 * 1000));
}
// TODO: exrule is deprecated. what to do? (https://icalendar.org/iCalendar-RFC-5545/a-3-deprecated-features.html)
for (var _a = 0, exruleInputs_1 = exruleInputs; _a < exruleInputs_1.length; _a++) {
var exruleInput = exruleInputs_1[_a];
var res = parseRRuleObject(exruleInput, dateEnv);
isTimeSpecified = isTimeSpecified || res.isTimeSpecified;
isTimeZoneSpecified = isTimeZoneSpecified || res.isTimeZoneSpecified;
rruleSet.exrule(res.rrule);
}
return { rruleSet: rruleSet, isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
function parseRRuleObject(rruleInput, dateEnv) {
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
function processDateInput(dateInput) {
if (typeof dateInput === 'string') {
var markerData = common.parseMarker(dateInput);
if (markerData) {
isTimeSpecified = isTimeSpecified || !markerData.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || markerData.timeZoneOffset !== null;
return new Date(markerData.marker.valueOf() - (markerData.timeZoneOffset || 0) * 60 * 1000); // NOT DRY
}
else { // invalid
delete refined.dtstart; // best idea?
}
return null;
}
if (typeof refined.until === 'string') {
var result = common.parseMarker(refined.until);
// TODO: not DRY
if (result) {
isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || result.timeZoneOffset !== null;
refined.until = new Date(result.marker.valueOf() - (result.timeZoneOffset || 0) * 60 * 1000);
}
else { // invalid
delete refined.until; // best idea?
}
}
if (refined.freq != null) {
refined.freq = convertConstant(refined.freq);
}
if (refined.wkst != null) {
refined.wkst = convertConstant(refined.wkst);
}
else {
refined.wkst = (dateEnv.weekDow - 1 + 7) % 7; // convert Sunday-first to Monday-first
}
if (refined.byweekday != null) {
refined.byweekday = convertConstants(refined.byweekday); // the plural version
}
rrule$1 = new rrule.RRule(refined);
return dateInput; // TODO: what about number timestamps?
}
if (rrule$1) {
return { rrule: rrule$1, isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
return null;
var rruleOptions = tslib.__assign(tslib.__assign({}, rruleInput), { dtstart: processDateInput(rruleInput.dtstart), until: processDateInput(rruleInput.until), freq: convertConstant(rruleInput.freq), wkst: rruleInput.wkst == null
? (dateEnv.weekDow - 1 + 7) % 7 // convert Sunday-first to Monday-first
: convertConstant(rruleInput.wkst), byweekday: convertConstants(rruleInput.wkst) });
return { rrule: new rrule.RRule(rruleOptions), isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
function parseRRuleString(str) {
var rruleSet = rrule.rrulestr(str, { forceset: true });
var analysis = analyzeRRuleString(str);
return tslib.__assign({ rruleSet: rruleSet }, analysis);
}
function analyzeRRuleString(str) {
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
function process(whole, introPart, datePart) {
// TODO: not DRY
function processMatch(whole, introPart, datePart) {
var result = common.parseMarker(datePart);

@@ -117,5 +128,5 @@ isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;

}
str.replace(/\b(DTSTART:)([^\n]*)/, process);
str.replace(/\b(EXDATE:)([^\n]*)/, process);
str.replace(/\b(UNTIL=)([^;]*)/, process);
str.replace(/\b(DTSTART:)([^\n]*)/, processMatch);
str.replace(/\b(EXDATE:)([^\n]*)/, processMatch);
str.replace(/\b(UNTIL=)([^;]*)/, processMatch);
return { isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };

@@ -122,0 +133,0 @@ }

@@ -1,5 +0,17 @@

import { Identity, createDuration, PluginDef } from '@fullcalendar/common';
import { Identity, DateInput, createDuration, PluginDef } from '@fullcalendar/common';
import { Options } from 'rrule';
declare type RRuleInputObjectFull = Omit<Options, 'dtstart' | 'until' | 'freq' | 'wkst' | 'byweekday'> & {
dtstart: Options['dtstart'] | DateInput;
until: Options['until'] | DateInput;
freq: Options['until'] | string;
wkst: Options['wkst'] | string;
byweekday: Options['byweekday'] | string;
};
declare type RRuleInputObject = Partial<RRuleInputObjectFull>;
declare type RRuleInput = RRuleInputObject | string;
declare const RRULE_EVENT_REFINERS: {
rrule: Identity<any>;
rrule: Identity<RRuleInput>;
exrule: Identity<Partial<RRuleInputObjectFull> | Partial<RRuleInputObjectFull>[]>;
exdate: Identity<string | number | Date | number[] | DateInput[]>;
duration: typeof createDuration;

@@ -6,0 +18,0 @@ };

/*!
FullCalendar v5.3.2
FullCalendar v5.5.0
Docs & License: https://fullcalendar.io/

@@ -37,2 +37,4 @@ (c) 2020 Adam Shaw

rrule: common.identity,
exrule: common.identity,
exdate: common.identity,
duration: common.createDuration,

@@ -42,10 +44,10 @@ };

var recurring = {
parse: function (refined, dateEnv) {
if (refined.rrule != null) {
var parsed = parseRRule(refined.rrule, dateEnv);
if (parsed) {
parse: function (eventProps, dateEnv) {
if (eventProps.rrule != null) {
var eventRRuleData = parseEventRRule(eventProps, dateEnv);
if (eventRRuleData) {
return {
typeData: { rrule: parsed.rrule, isTimeZoneSpecified: parsed.isTimeZoneSpecified },
allDayGuess: !parsed.isTimeSpecified,
duration: refined.duration,
typeData: { rruleSet: eventRRuleData.rruleSet, isTimeZoneSpecified: eventRRuleData.isTimeZoneSpecified },
allDayGuess: !eventRRuleData.isTimeSpecified,
duration: eventProps.duration,
};

@@ -56,11 +58,14 @@ }

},
expand: function (parsed, framingRange, dateEnv) {
var dates = parsed.rrule.between(framingRange.start, framingRange.end, true); // always UTC
if (parsed.isTimeZoneSpecified) { // not already in DateMarker form
dates = dates.map(function (date) { return dateEnv.createMarker(date); });
expand: function (eventRRuleData, framingRange, dateEnv) {
var dates;
if (eventRRuleData.isTimeZoneSpecified) {
dates = eventRRuleData.rruleSet.between(dateEnv.toDate(framingRange.start), // rrule lib will treat as UTC-zoned
dateEnv.toDate(framingRange.end), // (same)
true).map(function (date) { return dateEnv.createMarker(date); }); // convert UTC-zoned-date to locale datemarker
}
// we WANT an inclusive start and in exclusive end, but the js rrule lib will only do either BOTH
// inclusive or BOTH exclusive, which is stupid: https://github.com/jakubroztocil/rrule/issues/84
// Workaround: make inclusive, which will generate extra occurences, and then trim.
dates = dates.filter(function (date) { return date.valueOf() < framingRange.end.valueOf(); });
else {
// when no timezone in given start/end, the rrule lib will assume UTC,
// which is same as our DateMarkers. no need to manipulate
dates = eventRRuleData.rruleSet.between(framingRange.start, framingRange.end, true);
}
return dates;

@@ -73,62 +78,68 @@ },

});
function parseRRule(input, dateEnv) {
function parseEventRRule(eventProps, dateEnv) {
var rruleSet;
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
var rrule$1;
if (typeof input === 'string') {
rrule$1 = rrule.rrulestr(input);
var result = analyzeRRuleString(input);
isTimeSpecified = result.isTimeSpecified;
isTimeZoneSpecified = result.isTimeZoneSpecified;
if (typeof eventProps.rrule === 'string') {
var res = parseRRuleString(eventProps.rrule);
rruleSet = res.rruleSet;
isTimeSpecified = res.isTimeSpecified;
isTimeZoneSpecified = res.isTimeZoneSpecified;
}
else if (typeof input === 'object' && input) { // non-null object
var refined = __assign({}, input); // copy
if (typeof refined.dtstart === 'string') {
var result = common.parseMarker(refined.dtstart);
// TODO: not DRY
if (result) {
isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || result.timeZoneOffset !== null;
refined.dtstart = new Date(result.marker.valueOf() - (result.timeZoneOffset || 0) * 60 * 1000);
if (typeof eventProps.rrule === 'object' && eventProps.rrule) { // non-null object
var res = parseRRuleObject(eventProps.rrule, dateEnv);
rruleSet = new rrule.RRuleSet();
rruleSet.rrule(res.rrule);
isTimeSpecified = res.isTimeSpecified;
isTimeZoneSpecified = res.isTimeZoneSpecified;
}
// convery to arrays. TODO: general util?
var exdateInputs = [].concat(eventProps.exdate || []);
var exruleInputs = [].concat(eventProps.exrule || []);
for (var _i = 0, exdateInputs_1 = exdateInputs; _i < exdateInputs_1.length; _i++) {
var exdateInput = exdateInputs_1[_i];
var res = common.parseMarker(exdateInput);
isTimeSpecified = isTimeSpecified || !res.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || res.timeZoneOffset !== null;
rruleSet.exdate(new Date(res.marker.valueOf() - (res.timeZoneOffset || 0) * 60 * 1000));
}
// TODO: exrule is deprecated. what to do? (https://icalendar.org/iCalendar-RFC-5545/a-3-deprecated-features.html)
for (var _a = 0, exruleInputs_1 = exruleInputs; _a < exruleInputs_1.length; _a++) {
var exruleInput = exruleInputs_1[_a];
var res = parseRRuleObject(exruleInput, dateEnv);
isTimeSpecified = isTimeSpecified || res.isTimeSpecified;
isTimeZoneSpecified = isTimeZoneSpecified || res.isTimeZoneSpecified;
rruleSet.exrule(res.rrule);
}
return { rruleSet: rruleSet, isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
function parseRRuleObject(rruleInput, dateEnv) {
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
function processDateInput(dateInput) {
if (typeof dateInput === 'string') {
var markerData = common.parseMarker(dateInput);
if (markerData) {
isTimeSpecified = isTimeSpecified || !markerData.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || markerData.timeZoneOffset !== null;
return new Date(markerData.marker.valueOf() - (markerData.timeZoneOffset || 0) * 60 * 1000); // NOT DRY
}
else { // invalid
delete refined.dtstart; // best idea?
}
return null;
}
if (typeof refined.until === 'string') {
var result = common.parseMarker(refined.until);
// TODO: not DRY
if (result) {
isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || result.timeZoneOffset !== null;
refined.until = new Date(result.marker.valueOf() - (result.timeZoneOffset || 0) * 60 * 1000);
}
else { // invalid
delete refined.until; // best idea?
}
}
if (refined.freq != null) {
refined.freq = convertConstant(refined.freq);
}
if (refined.wkst != null) {
refined.wkst = convertConstant(refined.wkst);
}
else {
refined.wkst = (dateEnv.weekDow - 1 + 7) % 7; // convert Sunday-first to Monday-first
}
if (refined.byweekday != null) {
refined.byweekday = convertConstants(refined.byweekday); // the plural version
}
rrule$1 = new rrule.RRule(refined);
return dateInput; // TODO: what about number timestamps?
}
if (rrule$1) {
return { rrule: rrule$1, isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
return null;
var rruleOptions = __assign(__assign({}, rruleInput), { dtstart: processDateInput(rruleInput.dtstart), until: processDateInput(rruleInput.until), freq: convertConstant(rruleInput.freq), wkst: rruleInput.wkst == null
? (dateEnv.weekDow - 1 + 7) % 7 // convert Sunday-first to Monday-first
: convertConstant(rruleInput.wkst), byweekday: convertConstants(rruleInput.wkst) });
return { rrule: new rrule.RRule(rruleOptions), isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
function parseRRuleString(str) {
var rruleSet = rrule.rrulestr(str, { forceset: true });
var analysis = analyzeRRuleString(str);
return __assign({ rruleSet: rruleSet }, analysis);
}
function analyzeRRuleString(str) {
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
function process(whole, introPart, datePart) {
// TODO: not DRY
function processMatch(whole, introPart, datePart) {
var result = common.parseMarker(datePart);

@@ -138,5 +149,5 @@ isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;

}
str.replace(/\b(DTSTART:)([^\n]*)/, process);
str.replace(/\b(EXDATE:)([^\n]*)/, process);
str.replace(/\b(UNTIL=)([^;]*)/, process);
str.replace(/\b(DTSTART:)([^\n]*)/, processMatch);
str.replace(/\b(EXDATE:)([^\n]*)/, processMatch);
str.replace(/\b(UNTIL=)([^;]*)/, processMatch);
return { isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };

@@ -143,0 +154,0 @@ }

/*!
FullCalendar v5.3.2
FullCalendar v5.5.0
Docs & License: https://fullcalendar.io/
(c) 2020 Adam Shaw
*/
var FullCalendarRRule=function(e,r,i){"use strict";var t=function(){return(t=Object.assign||function(e){for(var r,i=1,t=arguments.length;i<t;i++)for(var n in r=arguments[i])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},n={rrule:r.identity,duration:r.createDuration},u={parse:function(e,n){if(null!=e.rrule){var u=function(e,n){var u,a=!1,f=!1;if("string"==typeof e){u=i.rrulestr(e);var s=function(e){var i=!1,t=!1;function n(e,n,u){var a=r.parseMarker(u);i=i||!a.isTimeUnspecified,t=t||null!==a.timeZoneOffset}return e.replace(/\b(DTSTART:)([^\n]*)/,n),e.replace(/\b(EXDATE:)([^\n]*)/,n),e.replace(/\b(UNTIL=)([^;]*)/,n),{isTimeSpecified:i,isTimeZoneSpecified:t}}(e);a=s.isTimeSpecified,f=s.isTimeZoneSpecified}else if("object"==typeof e&&e){var o=t({},e);if("string"==typeof o.dtstart)(s=r.parseMarker(o.dtstart))?(a=a||!s.isTimeUnspecified,f=f||null!==s.timeZoneOffset,o.dtstart=new Date(s.marker.valueOf()-60*(s.timeZoneOffset||0)*1e3)):delete o.dtstart;if("string"==typeof o.until)(s=r.parseMarker(o.until))?(a=a||!s.isTimeUnspecified,f=f||null!==s.timeZoneOffset,o.until=new Date(s.marker.valueOf()-60*(s.timeZoneOffset||0)*1e3)):delete o.until;null!=o.freq&&(o.freq=l(o.freq)),null!=o.wkst?o.wkst=l(o.wkst):o.wkst=(n.weekDow-1+7)%7,null!=o.byweekday&&(o.byweekday=function(e){if(Array.isArray(e))return e.map(l);return l(e)}(o.byweekday)),u=new i.RRule(o)}if(u)return{rrule:u,isTimeSpecified:a,isTimeZoneSpecified:f};return null}(e.rrule,n);if(u)return{typeData:{rrule:u.rrule,isTimeZoneSpecified:u.isTimeZoneSpecified},allDayGuess:!u.isTimeSpecified,duration:e.duration}}return null},expand:function(e,r,i){var t=e.rrule.between(r.start,r.end,!0);return e.isTimeZoneSpecified&&(t=t.map((function(e){return i.createMarker(e)}))),t=t.filter((function(e){return e.valueOf()<r.end.valueOf()}))}},a=r.createPlugin({recurringTypes:[u],eventRefiners:n});function l(e){return"string"==typeof e?i.RRule[e.toUpperCase()]:e}return r.globalPlugins.push(a),e.default=a,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,rrule);
var FullCalendarRRule=function(e,r,i){"use strict";var t=function(){return(t=Object.assign||function(e){for(var r,i=1,t=arguments.length;i<t;i++)for(var n in r=arguments[i])Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n]);return e}).apply(this,arguments)},n={rrule:r.identity,exrule:r.identity,exdate:r.identity,duration:r.createDuration},u={parse:function(e,n){if(null!=e.rrule){var u=function(e,n){var u,a=!1,f=!1;if("string"==typeof e.rrule){var s=function(e){var n=i.rrulestr(e,{forceset:!0}),u=function(e){var i=!1,t=!1;function n(e,n,u){var a=r.parseMarker(u);i=i||!a.isTimeUnspecified,t=t||null!==a.timeZoneOffset}return e.replace(/\b(DTSTART:)([^\n]*)/,n),e.replace(/\b(EXDATE:)([^\n]*)/,n),e.replace(/\b(UNTIL=)([^;]*)/,n),{isTimeSpecified:i,isTimeZoneSpecified:t}}(e);return t({rruleSet:n},u)}(e.rrule);u=s.rruleSet,a=s.isTimeSpecified,f=s.isTimeZoneSpecified}if("object"==typeof e.rrule&&e.rrule){s=l(e.rrule,n);(u=new i.RRuleSet).rrule(s.rrule),a=s.isTimeSpecified,f=s.isTimeZoneSpecified}for(var o=[].concat(e.exdate||[]),c=[].concat(e.exrule||[]),p=0,d=o;p<d.length;p++){var m=d[p];s=r.parseMarker(m);a=a||!s.isTimeUnspecified,f=f||null!==s.timeZoneOffset,u.exdate(new Date(s.marker.valueOf()-60*(s.timeZoneOffset||0)*1e3))}for(var S=0,T=c;S<T.length;S++){s=l(T[S],n);a=a||s.isTimeSpecified,f=f||s.isTimeZoneSpecified,u.exrule(s.rrule)}return{rruleSet:u,isTimeSpecified:a,isTimeZoneSpecified:f}}(e,n);if(u)return{typeData:{rruleSet:u.rruleSet,isTimeZoneSpecified:u.isTimeZoneSpecified},allDayGuess:!u.isTimeSpecified,duration:e.duration}}return null},expand:function(e,r,i){return e.isTimeZoneSpecified?e.rruleSet.between(i.toDate(r.start),i.toDate(r.end),!0).map((function(e){return i.createMarker(e)})):e.rruleSet.between(r.start,r.end,!0)}},a=r.createPlugin({recurringTypes:[u],eventRefiners:n});function l(e,n){var u=!1,a=!1;function l(e){if("string"==typeof e){var i=r.parseMarker(e);return i?(u=u||!i.isTimeUnspecified,a=a||null!==i.timeZoneOffset,new Date(i.marker.valueOf()-60*(i.timeZoneOffset||0)*1e3)):null}return e}var o=t(t({},e),{dtstart:l(e.dtstart),until:l(e.until),freq:s(e.freq),wkst:null==e.wkst?(n.weekDow-1+7)%7:s(e.wkst),byweekday:f(e.wkst)});return{rrule:new i.RRule(o),isTimeSpecified:u,isTimeZoneSpecified:a}}function f(e){return Array.isArray(e)?e.map(s):s(e)}function s(e){return"string"==typeof e?i.RRule[e.toUpperCase()]:e}return r.globalPlugins.push(a),e.default=a,Object.defineProperty(e,"__esModule",{value:!0}),e}({},FullCalendar,rrule);
/*!
FullCalendar v5.3.2
FullCalendar v5.5.0
Docs & License: https://fullcalendar.io/

@@ -7,3 +7,3 @@ (c) 2020 Adam Shaw

import { __assign } from 'tslib';
import { rrulestr, RRule } from 'rrule';
import { RRule, RRuleSet, rrulestr } from 'rrule';
import { identity, createDuration, createPlugin, parseMarker } from '@fullcalendar/common';

@@ -13,2 +13,4 @@

rrule: identity,
exrule: identity,
exdate: identity,
duration: createDuration,

@@ -18,10 +20,10 @@ };

var recurring = {
parse: function (refined, dateEnv) {
if (refined.rrule != null) {
var parsed = parseRRule(refined.rrule, dateEnv);
if (parsed) {
parse: function (eventProps, dateEnv) {
if (eventProps.rrule != null) {
var eventRRuleData = parseEventRRule(eventProps, dateEnv);
if (eventRRuleData) {
return {
typeData: { rrule: parsed.rrule, isTimeZoneSpecified: parsed.isTimeZoneSpecified },
allDayGuess: !parsed.isTimeSpecified,
duration: refined.duration,
typeData: { rruleSet: eventRRuleData.rruleSet, isTimeZoneSpecified: eventRRuleData.isTimeZoneSpecified },
allDayGuess: !eventRRuleData.isTimeSpecified,
duration: eventProps.duration,
};

@@ -32,11 +34,14 @@ }

},
expand: function (parsed, framingRange, dateEnv) {
var dates = parsed.rrule.between(framingRange.start, framingRange.end, true); // always UTC
if (parsed.isTimeZoneSpecified) { // not already in DateMarker form
dates = dates.map(function (date) { return dateEnv.createMarker(date); });
expand: function (eventRRuleData, framingRange, dateEnv) {
var dates;
if (eventRRuleData.isTimeZoneSpecified) {
dates = eventRRuleData.rruleSet.between(dateEnv.toDate(framingRange.start), // rrule lib will treat as UTC-zoned
dateEnv.toDate(framingRange.end), // (same)
true).map(function (date) { return dateEnv.createMarker(date); }); // convert UTC-zoned-date to locale datemarker
}
// we WANT an inclusive start and in exclusive end, but the js rrule lib will only do either BOTH
// inclusive or BOTH exclusive, which is stupid: https://github.com/jakubroztocil/rrule/issues/84
// Workaround: make inclusive, which will generate extra occurences, and then trim.
dates = dates.filter(function (date) { return date.valueOf() < framingRange.end.valueOf(); });
else {
// when no timezone in given start/end, the rrule lib will assume UTC,
// which is same as our DateMarkers. no need to manipulate
dates = eventRRuleData.rruleSet.between(framingRange.start, framingRange.end, true);
}
return dates;

@@ -49,62 +54,68 @@ },

});
function parseRRule(input, dateEnv) {
function parseEventRRule(eventProps, dateEnv) {
var rruleSet;
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
var rrule;
if (typeof input === 'string') {
rrule = rrulestr(input);
var result = analyzeRRuleString(input);
isTimeSpecified = result.isTimeSpecified;
isTimeZoneSpecified = result.isTimeZoneSpecified;
if (typeof eventProps.rrule === 'string') {
var res = parseRRuleString(eventProps.rrule);
rruleSet = res.rruleSet;
isTimeSpecified = res.isTimeSpecified;
isTimeZoneSpecified = res.isTimeZoneSpecified;
}
else if (typeof input === 'object' && input) { // non-null object
var refined = __assign({}, input); // copy
if (typeof refined.dtstart === 'string') {
var result = parseMarker(refined.dtstart);
// TODO: not DRY
if (result) {
isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || result.timeZoneOffset !== null;
refined.dtstart = new Date(result.marker.valueOf() - (result.timeZoneOffset || 0) * 60 * 1000);
if (typeof eventProps.rrule === 'object' && eventProps.rrule) { // non-null object
var res = parseRRuleObject(eventProps.rrule, dateEnv);
rruleSet = new RRuleSet();
rruleSet.rrule(res.rrule);
isTimeSpecified = res.isTimeSpecified;
isTimeZoneSpecified = res.isTimeZoneSpecified;
}
// convery to arrays. TODO: general util?
var exdateInputs = [].concat(eventProps.exdate || []);
var exruleInputs = [].concat(eventProps.exrule || []);
for (var _i = 0, exdateInputs_1 = exdateInputs; _i < exdateInputs_1.length; _i++) {
var exdateInput = exdateInputs_1[_i];
var res = parseMarker(exdateInput);
isTimeSpecified = isTimeSpecified || !res.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || res.timeZoneOffset !== null;
rruleSet.exdate(new Date(res.marker.valueOf() - (res.timeZoneOffset || 0) * 60 * 1000));
}
// TODO: exrule is deprecated. what to do? (https://icalendar.org/iCalendar-RFC-5545/a-3-deprecated-features.html)
for (var _a = 0, exruleInputs_1 = exruleInputs; _a < exruleInputs_1.length; _a++) {
var exruleInput = exruleInputs_1[_a];
var res = parseRRuleObject(exruleInput, dateEnv);
isTimeSpecified = isTimeSpecified || res.isTimeSpecified;
isTimeZoneSpecified = isTimeZoneSpecified || res.isTimeZoneSpecified;
rruleSet.exrule(res.rrule);
}
return { rruleSet: rruleSet, isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
function parseRRuleObject(rruleInput, dateEnv) {
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
function processDateInput(dateInput) {
if (typeof dateInput === 'string') {
var markerData = parseMarker(dateInput);
if (markerData) {
isTimeSpecified = isTimeSpecified || !markerData.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || markerData.timeZoneOffset !== null;
return new Date(markerData.marker.valueOf() - (markerData.timeZoneOffset || 0) * 60 * 1000); // NOT DRY
}
else { // invalid
delete refined.dtstart; // best idea?
}
return null;
}
if (typeof refined.until === 'string') {
var result = parseMarker(refined.until);
// TODO: not DRY
if (result) {
isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;
isTimeZoneSpecified = isTimeZoneSpecified || result.timeZoneOffset !== null;
refined.until = new Date(result.marker.valueOf() - (result.timeZoneOffset || 0) * 60 * 1000);
}
else { // invalid
delete refined.until; // best idea?
}
}
if (refined.freq != null) {
refined.freq = convertConstant(refined.freq);
}
if (refined.wkst != null) {
refined.wkst = convertConstant(refined.wkst);
}
else {
refined.wkst = (dateEnv.weekDow - 1 + 7) % 7; // convert Sunday-first to Monday-first
}
if (refined.byweekday != null) {
refined.byweekday = convertConstants(refined.byweekday); // the plural version
}
rrule = new RRule(refined);
return dateInput; // TODO: what about number timestamps?
}
if (rrule) {
return { rrule: rrule, isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
return null;
var rruleOptions = __assign(__assign({}, rruleInput), { dtstart: processDateInput(rruleInput.dtstart), until: processDateInput(rruleInput.until), freq: convertConstant(rruleInput.freq), wkst: rruleInput.wkst == null
? (dateEnv.weekDow - 1 + 7) % 7 // convert Sunday-first to Monday-first
: convertConstant(rruleInput.wkst), byweekday: convertConstants(rruleInput.wkst) });
return { rrule: new RRule(rruleOptions), isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };
}
function parseRRuleString(str) {
var rruleSet = rrulestr(str, { forceset: true });
var analysis = analyzeRRuleString(str);
return __assign({ rruleSet: rruleSet }, analysis);
}
function analyzeRRuleString(str) {
var isTimeSpecified = false;
var isTimeZoneSpecified = false;
function process(whole, introPart, datePart) {
// TODO: not DRY
function processMatch(whole, introPart, datePart) {
var result = parseMarker(datePart);

@@ -114,5 +125,5 @@ isTimeSpecified = isTimeSpecified || !result.isTimeUnspecified;

}
str.replace(/\b(DTSTART:)([^\n]*)/, process);
str.replace(/\b(EXDATE:)([^\n]*)/, process);
str.replace(/\b(UNTIL=)([^;]*)/, process);
str.replace(/\b(DTSTART:)([^\n]*)/, processMatch);
str.replace(/\b(EXDATE:)([^\n]*)/, processMatch);
str.replace(/\b(UNTIL=)([^;]*)/, processMatch);
return { isTimeSpecified: isTimeSpecified, isTimeZoneSpecified: isTimeZoneSpecified };

@@ -119,0 +130,0 @@ }

{
"name": "@fullcalendar/rrule",
"version": "5.4.0",
"version": "5.5.0",
"title": "FullCalendar RRule Plugin",

@@ -8,3 +8,3 @@ "description": "A connector to the RRule library, for recurring events",

"dependencies": {
"@fullcalendar/common": "~5.4.0",
"@fullcalendar/common": "~5.5.0",
"tslib": "^2.0.3"

@@ -16,3 +16,3 @@ },

"devDependencies": {
"@fullcalendar/core-preact": "5.4.0",
"@fullcalendar/core-preact": "5.5.0",
"rrule": "^2.6.0"

@@ -19,0 +19,0 @@ },

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc