devextreme
Version:
HTML5 JavaScript Component Suite for Responsive Web Development
35 lines (34 loc) • 1.65 kB
JavaScript
/**
* DevExtreme (esm/renovation/ui/scheduler/utils/recurrence/excludeFromRecurrence.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/
*/
import _extends from "@babel/runtime/helpers/esm/extends";
import {
createAppointmentAdapter
} from "../../../../../ui/scheduler/appointmentAdapter";
import dateSerialization from "../../../../../core/utils/date_serialization";
var FULL_DATE_FORMAT = "yyyyMMddTHHmmss";
var UTC_FULL_DATE_FORMAT = "".concat(FULL_DATE_FORMAT, "Z");
var getSerializedDate = (date, startDate, isAllDay) => {
if (isAllDay) {
date.setHours(startDate.getHours(), startDate.getMinutes(), startDate.getSeconds(), startDate.getMilliseconds())
}
return dateSerialization.serializeDate(date, UTC_FULL_DATE_FORMAT)
};
var createRecurrenceException = (appointmentAdapter, exceptionDate) => {
var result = [];
if (appointmentAdapter.recurrenceException) {
result.push(appointmentAdapter.recurrenceException)
}
result.push(getSerializedDate(exceptionDate, appointmentAdapter.startDate, appointmentAdapter.allDay));
return result.join()
};
export var excludeFromRecurrence = (appointment, exceptionDate, dataAccessors, timeZoneCalculator) => {
var appointmentAdapter = createAppointmentAdapter(_extends({}, appointment), dataAccessors, timeZoneCalculator);
appointmentAdapter.recurrenceException = createRecurrenceException(appointmentAdapter, exceptionDate);
return appointmentAdapter
};