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/es5/components/VCalendar/util/events.js

44 lines
1.5 KiB
JavaScript
Raw Normal View History

2019-08-11 18:48:02 +00:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.parseEvent = parseEvent;
exports.isEventOn = isEventOn;
exports.isEventOverlapping = isEventOverlapping;
var _timestamp = require("./timestamp");
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');
}
var start = (0, _timestamp.parseTimestamp)(input[startProperty]);
var end = input[endProperty] ? (0, _timestamp.parseTimestamp)(input[endProperty]) : start;
var startIdentifier = (0, _timestamp.getDayIdentifier)(start);
var startTimestampIdentifier = (0, _timestamp.getTimestampIdentifier)(start);
var endIdentifier = (0, _timestamp.getDayIdentifier)(end);
var endTimestampIdentifier = (0, _timestamp.getTimestampIdentifier)(end);
var allDay = !start.hasTime;
return {
input: input,
start: start,
startIdentifier: startIdentifier,
startTimestampIdentifier: startTimestampIdentifier,
end: end,
endIdentifier: endIdentifier,
endTimestampIdentifier: endTimestampIdentifier,
allDay: allDay,
index: index
};
}
function isEventOn(event, dayIdentifier) {
return dayIdentifier >= event.startIdentifier && dayIdentifier <= event.endIdentifier;
}
function isEventOverlapping(event, startIdentifier, endIdentifier) {
return startIdentifier <= event.endIdentifier && endIdentifier >= event.startIdentifier;
}
//# sourceMappingURL=events.js.map