Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
CalendarLink.prototype.google = function (event) {
event = sanitizeEvent(event);
var startDate = dayjs_1.default(event.start)
.toISOString()
.replace(/-/g, '')
.replace(/:/g, '')
.replace(/\./g, '');
var endDate = dayjs_1.default(event.end)
.toISOString()
.replace(/-/g, '')
.replace(/:/g, '')
.replace(/\./g, '');
var details = {
action: 'TEMPLATE',
text: event.title,
details: event.description,
location: event.location,
trp: event.busy,
dates: startDate.substring(0, startDate.length - 4) +
'Z/' +
endDate.substring(0, endDate.length - 4) +
'Z'
};
if (event.guests && event.guests.length) {
function sanitizeEvent(event) {
event.start = dayjs_1.default(event.start).toDate();
if (event.duration && event.duration.length && !event.end) {
var duration = +event.duration[0];
var unit = event.duration[0];
event.end = dayjs_1.default(event.start)
.add(duration, unit)
.toDate();
}
return event;
}
var CalendarLink = /** @class */ (function () {
CalendarLink.prototype.yahoo = function (event) {
event = sanitizeEvent(event);
var details = {
v: 60,
title: event.title,
st: dayjs_1.default(event.start).format('YYYYMMDD[T]HHmmss'),
et: dayjs_1.default(event.end).format('YYYYMMDD[T]HHmmss'),
desc: event.description,
in_loc: event.location
};
return 'https://calendar.yahoo.com/' + object_to_querystring_1.default(details);
};
return CalendarLink;
CalendarLink.prototype.google = function (event) {
event = sanitizeEvent(event);
var startDate = dayjs_1.default(event.start)
.toISOString()
.replace(/-/g, '')
.replace(/:/g, '')
.replace(/\./g, '');
var endDate = dayjs_1.default(event.end)
.toISOString()
.replace(/-/g, '')
.replace(/:/g, '')
.replace(/\./g, '');
var details = {
action: 'TEMPLATE',
text: event.title,
details: event.description,
location: event.location,
trp: event.busy,
dates: startDate.substring(0, startDate.length - 4) +
function sanitizeEvent(event) {
event.start = dayjs_1.default(event.start).toDate();
if (event.duration && event.duration.length && !event.end) {
var duration = +event.duration[0];
var unit = event.duration[0];
event.end = dayjs_1.default(event.start)
.add(duration, unit)
.toDate();
}
return event;
}
var CalendarLink = /** @class */ (function () {
CalendarLink.prototype.yahoo = function (event) {
event = sanitizeEvent(event);
var details = {
v: 60,
title: event.title,
st: dayjs_1.default(event.start).format('YYYYMMDD[T]HHmmss'),
et: dayjs_1.default(event.end).format('YYYYMMDD[T]HHmmss'),
desc: event.description,
in_loc: event.location
};
return 'https://calendar.yahoo.com/' + object_to_querystring_1.default(details);
};
return CalendarLink;