UNPKG

@progress/kendo-react-scheduler

Version:

React Scheduler brings the functionality of Outlook's Calendar to a single UI component. KendoReact Scheduler package

39 lines (38 loc) 1.41 kB
/** * @license *------------------------------------------------------------------------------------------- * Copyright © 2025 Progress Software Corporation. All rights reserved. * Licensed under commercial license. See LICENSE.md in the package root for more information *------------------------------------------------------------------------------------------- */ import * as D from "react"; import { MS_PER_DAY as M } from "@progress/kendo-date-math"; import { MS_PER_MINUTE as m } from "../constants/index.mjs"; const v = (O, { step: t }, { groups: l, ranges: z }) => { const i = []; return l.forEach((E) => { z.forEach((o) => { const s = o.zonedStart, f = o.zonedEnd, r = f.timezoneOffset - s.timezoneOffset; for (let e = s.clone(), a = 0, d = r < 0 ? r * m * -1 : 0; e.getTime() < f.getTime(); ) { const T = D.createRef(), n = e.clone(), c = e.addTime(t), S = (c.timezoneOffset - n.timezoneOffset) * m, _ = t <= Math.abs(S); d && _ && (d -= t, e = e.addTime(-t)); const R = new Date(n.getTime()), h = new Date(c.getTime()), w = { _ref: T, index: a, end: h, start: R, zonedStart: n, zonedEnd: c, range: o, group: E, items: [], isAllDay: M <= t }; i.push(w), e = e.addTime(t), a++; } }); }), i; }; export { v as toSlots };