Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function getTimeGridLine(date) { // not in Scheduler
date = ensureDate(date)
var day = startOfDay(date)
var timeMs = date.valueOf() - day.valueOf()
var top = getTimeGridTop(timeMs)
var dayEls = getTimeGridDayEls(date)
var dayRect
expect(dayEls.length).toBe(1)
dayRect = getBoundingRect(dayEls.eq(0))
return {
left: dayRect.left,
right: dayRect.right,
top: top,
bottom: top
}
}
renderSlatRowHtml(dateProfile: DateProfile) {
let { dateEnv, theme, isRtl } = this.context
let html = ''
let dayStart = startOfDay(dateProfile.renderRange.start)
let slotTime = dateProfile.minTime
let slotIterator = createDuration(0)
let slotDate // will be on the view's first day, but we only care about its time
let isLabeled
let axisHtml
// Calculate the time for each slot
while (asRoughMs(slotTime) < asRoughMs(dateProfile.maxTime)) {
slotDate = dateEnv.add(dayStart, slotTime)
isLabeled = wholeDivideDurations(slotIterator, this.labelInterval) !== null
axisHtml =
'' +
(isLabeled ?
'<span>' + // for matchCellWidths
htmlEscape(dateEnv.format(slotDate, this.labelFormat)) +</span>
function computeEventMutation(hit0: Hit, hit1: Hit, massagers: eventDragMutationMassager[]): EventMutation {
let dateSpan0 = hit0.dateSpan
let dateSpan1 = hit1.dateSpan
let date0 = dateSpan0.range.start
let date1 = dateSpan1.range.start
let standardProps = {} as any
if (dateSpan0.allDay !== dateSpan1.allDay) {
standardProps.allDay = dateSpan1.allDay
standardProps.hasEnd = hit1.component.context.options.allDayMaintainDuration
if (dateSpan1.allDay) {
// means date1 is already start-of-day,
// but date0 needs to be converted
date0 = startOfDay(date0)
}
}
let delta = diffDates(
date0, date1,
hit0.component.context.dateEnv,
hit0.component === hit1.component ?
hit0.component.largeUnit :
null
)
if (delta.milliseconds) { // has hours/minutes/seconds
standardProps.allDay = false
}
let mutation: EventMutation = {
function computeEventMutation(hit0, hit1, massagers) {
var dateSpan0 = hit0.dateSpan;
var dateSpan1 = hit1.dateSpan;
var date0 = dateSpan0.range.start;
var date1 = dateSpan1.range.start;
var standardProps = {};
if (dateSpan0.allDay !== dateSpan1.allDay) {
standardProps.allDay = dateSpan1.allDay;
standardProps.hasEnd = hit1.component.opt('allDayMaintainDuration');
if (dateSpan1.allDay) {
// means date1 is already start-of-day,
// but date0 needs to be converted
date0 = startOfDay(date0);
}
}
var delta = diffDates(date0, date1, hit0.component.dateEnv, hit0.component === hit1.component ?
hit0.component.largeUnit :
null);
if (delta.milliseconds) { // has hours/minutes/seconds
standardProps.allDay = false;
}
var mutation = {
datesDelta: delta,
standardProps: standardProps
};
for (var _i = 0, massagers_1 = massagers; _i < massagers_1.length; _i++) {
var massager = massagers_1[_i];
massager(mutation, hit0, hit1);
}
export function getTimeGridPoint(date) {
date = ensureDate(date)
var day = startOfDay(date)
var timeMs = date.valueOf() - day.valueOf()
var top = getTimeGridTop(timeMs)
var dayEls = getTimeGridDayEls(date)
var dayRect
expect(dayEls.length).toBe(1)
dayRect = getBoundingRect(dayEls.eq(0))
return {
left: (dayRect.left + dayRect.right) / 2,
top: top
}
}
computeDateTop(when: DateMarker, startOfDayDate?: DateMarker) {
if (!startOfDayDate) {
startOfDayDate = startOfDay(when)
}
return this.computeTimeTop(createDuration(when.valueOf() - startOfDayDate.valueOf()))
}
function computeDateVars(dateProfile) {
var dayStart = startOfDay(dateProfile.renderRange.start);
var viewEnd = dateProfile.renderRange.end;
var dayDates = [];
var dayRanges = [];
while (dayStart < viewEnd) {
dayDates.push(dayStart);
dayRanges.push({
start: dayStart,
end: addDays(dayStart, 1)
});
dayStart = addDays(dayStart, 1);
}
return { dayDates: dayDates, dayRanges: 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)
}