devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
38 lines (37 loc) • 1.58 kB
JavaScript
/**
* DevExtreme (cjs/ui/scheduler/appointments/resizing/utils.js)
* Version: 22.1.9
* Build date: Tue Apr 18 2023
*
* Copyright (c) 2012 - 2023 Developer Express Inc. ALL RIGHTS RESERVED
* Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
*/
;
exports.normalizeStartDate = exports.normalizeEndDate = void 0;
var normalizeDate = function(options, date, sourceDate, isStartDate) {
if (!options.considerTime) {
return date
}
var result = new Date(date);
result.setHours(sourceDate.getHours(), sourceDate.getMinutes(), sourceDate.getSeconds());
var startDayHour = options.startDayHour,
endDayHour = options.endDayHour,
allDay = options.appointmentSettings.allDay;
var minDate = new Date(date);
var maxDate = new Date(date);
minDate.setHours(startDayHour, 0, 0, 0);
maxDate.setHours(endDayHour, 0, 0, 0);
var isDateOutInterval = isStartDate ? result < minDate.getTime() || result >= maxDate.getTime() : result <= minDate.getTime() || result > maxDate.getTime();
if (isDateOutInterval) {
result = !allDay ? maxDate : minDate
}
return result
};
var normalizeStartDate = function(options, startDate, sourceStartDate) {
return normalizeDate(options, startDate, sourceStartDate, true)
};
exports.normalizeStartDate = normalizeStartDate;
var normalizeEndDate = function(options, endDate, sourceEndDate) {
return normalizeDate(options, endDate, sourceEndDate, false)
};
exports.normalizeEndDate = normalizeEndDate;