Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
resizeDate = resizeDateMeta.marker
} else {
resizeDateHasTime = true
}
eventEl = eventClassName ? $(`.${eventClassName}:first`) : getLastEventEl()
dragEl = getEventElResizerEl(eventEl)
if (resizeDateHasTime) {
lastDayEl = getTimeGridDayEls(resizeDate)
lastSlatIndex = resizeDate.getUTCHours() * 2 + (resizeDate.getUTCMinutes() / 30) // assumes slotDuration:'30:00'
lastSlatEl = getSlotElByIndex(lastSlatIndex - 1)
expect(lastSlatEl.length).toBe(1)
dy = lastSlatEl.offset().top + lastSlatEl.outerHeight() - (eventEl.offset().top + eventEl.outerHeight())
} else {
lastDayEl = getDayEl(addDays(resizeDate, -1))
dy = lastDayEl.offset().top - eventEl.offset().top
}
expect(lastDayEl.length).toBe(1)
expect(eventEl.length).toBe(1)
expect(dragEl.length).toBe(1)
dx = lastDayEl.offset().left + lastDayEl.outerWidth() - 2 - (eventEl.offset().left + eventEl.outerWidth())
dragEl.simulate('mouseover') // resizer only shows up on mouseover
dragEl.simulate('drag', {
dx: dx,
dy: dy,
onBeforeRelease: function() {
allowed = !$('body').hasClass('fc-not-allowed')
},
onRelease: function() {
queryHit(positionLeft: number, positionTop: number, elWidth: number, elHeight: number): Hit | null {
let date = (this.props as any).date // HACK
if (positionLeft < elWidth && positionTop < elHeight) {
return {
component: this,
dateSpan: {
allDay: true,
range: { start: date, end: addDays(date, 1) }
},
dayEl: this.el,
rect: {
left: 0,
top: 0,
right: elWidth,
bottom: elHeight
},
layer: 1
}
}
}
function buildRequestParams(range, apiKey, extraParams, dateEnv) {
var params;
var startStr;
var endStr;
if (dateEnv.canComputeOffset) {
// strings will naturally have offsets, which GCal needs
startStr = dateEnv.formatIso(range.start);
endStr = dateEnv.formatIso(range.end);
}
else {
// when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day
// from the UTC day-start to guarantee we're getting all the events
// (start/end will be UTC-coerced dates, so toISOString is okay)
startStr = addDays(range.start, -1).toISOString();
endStr = addDays(range.end, 1).toISOString();
}
params = __assign({}, (extraParams || {}), { key: apiKey, timeMin: startStr, timeMax: endStr, singleEvents: true, maxResults: 9999 });
if (dateEnv.timeZone !== 'local') {
params.timeZone = dateEnv.timeZone;
}
return params;
}
function gcalItemsToRawEventDefs(items, gcalTimezone) {
function buildRequestParams(range, apiKey, extraParams, dateEnv) {
var params;
var startStr;
var endStr;
if (dateEnv.canComputeOffset) {
// strings will naturally have offsets, which GCal needs
startStr = dateEnv.formatIso(range.start);
endStr = dateEnv.formatIso(range.end);
}
else {
// when timezone isn't known, we don't know what the UTC offset should be, so ask for +/- 1 day
// from the UTC day-start to guarantee we're getting all the events
// (start/end will be UTC-coerced dates, so toISOString is okay)
startStr = addDays(range.start, -1).toISOString();
endStr = addDays(range.end, 1).toISOString();
}
params = __assign({}, (extraParams || {}), { key: apiKey, timeMin: startStr, timeMax: endStr, singleEvents: true, maxResults: 9999 });
if (dateEnv.timeZone !== 'local') {
params.timeZone = dateEnv.timeZone;
}
return params;
}
function gcalItemsToRawEventDefs(items, gcalTimezone) {
resliceDaySegs(segs, dayDate) {
let dayStart = dayDate
let dayEnd = addDays(dayStart, 1)
let dayRange = { start: dayStart, end: dayEnd }
let newSegs = []
for (let seg of segs) {
let eventRange = seg.eventRange
let origRange = eventRange.range
let slicedRange = intersectRanges(origRange, dayRange)
if (slicedRange) {
newSegs.push({
...seg,
eventRange: {
def: eventRange.def,
ui: { ...eventRange.ui, durationEditable: false }, // hack to disable resizing
instance: eventRange.instance,
range: slicedRange
var title
if (typeof start === 'string') {
start = new Date(start)
}
if (typeof end === 'string') {
end = new Date(end)
}
if (typeof titleStart === 'string') {
titleStart = new Date(titleStart)
}
if (typeof titleEnd === 'string') {
titleEnd = new Date(titleEnd)
}
calculatedEnd = end || addDays(start, 1)
expect(start).toEqualDate(view.activeStart)
expect(calculatedEnd).toEqualDate(view.activeEnd)
titleStart = titleStart || start
titleEnd = titleEnd || calculatedEnd
if (titleEnd) {
title = currentCalendar.formatRange(
titleStart,
titleEnd,
TITLE_FORMAT
)
} else {
title = currentCalendar.formatDate(titleStart, TITLE_FORMAT)
}
getCellRange(row, col) {
let start = this.props.cells[row][col].date
let end = addDays(start, 1)
return { start, end }
}
private initWeekDayShortNames(): string[] {
let formatter = createFormatter({weekday: 'narrow'});
let names = [];
for (let i = 0; i < 7; i++) {
let date = addDays(new Date(), i);
names[date.getDay()] = this.dateEnv.format(date, formatter);
}
return names;
}
function computeDateVars(dateProfile: DateProfile) {
let dayStart = startOfDay(dateProfile.renderRange.start)
let viewEnd = dateProfile.renderRange.end
let dayDates: DateMarker[] = []
let dayRanges: DateRange[] = []
while (dayStart < viewEnd) {
dayDates.push(dayStart)
dayRanges.push({
start: dayStart,
end: addDays(dayStart, 1)
})
dayStart = addDays(dayStart, 1)
}
return { dayDates, dayRanges }
}
function computeDateVars(dateProfile: DateProfile) {
let dayStart = startOfDay(dateProfile.renderRange.start)
let viewEnd = dateProfile.renderRange.end
let dayDates: DateMarker[] = []
let dayRanges: DateRange[] = []
while (dayStart < viewEnd) {
dayDates.push(dayStart)
dayRanges.push({
start: dayStart,
end: addDays(dayStart, 1)
})
dayStart = addDays(dayStart, 1)
}
return { dayDates, dayRanges }
}