This repository has been archived on 2024-07-27. You can view files and clone it, but cannot push or open issues or pull requests.
keksAccountGUI/node_modulesOLD/vuetify/lib/components/VCalendar/util/events.js

32 lines
1.2 KiB
JavaScript
Raw Permalink Normal View History

2019-08-11 18:48:02 +00:00
import { parseTimestamp, getDayIdentifier, getTimestampIdentifier } from './timestamp';
export function parseEvent(input, index, startProperty, endProperty) {
if (!(startProperty in input)) {
throw new Error('The ' + startProperty + ' property is required on all events to be a valid timestamp in the format YYYY-MM-DD or YYYY-MM-DD hh:mm');
}
const start = parseTimestamp(input[startProperty]);
const end = input[endProperty] ? parseTimestamp(input[endProperty]) : start;
const startIdentifier = getDayIdentifier(start);
const startTimestampIdentifier = getTimestampIdentifier(start);
const endIdentifier = getDayIdentifier(end);
const endTimestampIdentifier = getTimestampIdentifier(end);
const allDay = !start.hasTime;
return {
input,
start,
startIdentifier,
startTimestampIdentifier,
end,
endIdentifier,
endTimestampIdentifier,
allDay,
index
};
}
export function isEventOn(event, dayIdentifier) {
return dayIdentifier >= event.startIdentifier && dayIdentifier <= event.endIdentifier;
}
export function isEventOverlapping(event, startIdentifier, endIdentifier) {
return startIdentifier <= event.endIdentifier && endIdentifier >= event.startIdentifier;
}
//# sourceMappingURL=events.js.map