@progress/kendo-react-scheduler
Version:
React Scheduler brings the functionality of Outlook's Calendar to a single UI component. KendoReact Scheduler package
48 lines (47 loc) • 2.03 kB
JavaScript
/**
* @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 u from "react";
import { MS_PER_DAY as S, Day as a, ZonedDate as d, getDate as p, addDays as T } from "@progress/kendo-date-math";
import { DAYS_IN_WEEK_COUNT as i } from "../../constants/index.mjs";
import { MultiDayView as E } from "../day/MultiDayView.mjs";
import { workWeekViewTitle as c, messages as R } from "../../messages/index.mjs";
import { toUTCDateTime as w } from "../../utils/index.mjs";
import { useSchedulerDateRangeContext as C } from "../../context/SchedulerContext.mjs";
const M = (t) => {
const o = C(), e = Math.round((o.end.getTime() - o.start.getTime()) / S);
return /* @__PURE__ */ u.createElement(E, { ...t, step: i, numberOfDays: e });
}, V = (t, o = a.Sunday) => {
let e = t.clone();
for (; e.getDay() !== o; )
e = e.addDays(-1);
return e;
}, _ = ({ intl: t, date: o, timezone: e, ...r }) => {
const l = d.fromLocalDate(o, e), n = r.workWeekStart !== void 0 ? r.workWeekStart : a.Monday, s = r.workWeekEnd !== void 0 ? r.workWeekEnd : a.Friday, W = s < n ? i + s - n + 1 : s - n + 1, k = p(V(l, n)), f = T(k, W), m = d.fromUTCDate(w(k), e), D = d.fromUTCDate(w(f), e), y = new Date(m.getTime()), g = new Date(D.getTime());
return {
start: y,
end: g,
zonedStart: m,
zonedEnd: D
};
}, h = {
name: "work-week",
slotDuration: 60,
slotDivisions: 2,
numberOfDays: i,
dateRange: _,
title: (t) => t.toLanguageString(c, R[c]),
workWeekStart: a.Monday,
workWeekEnd: a.Friday,
selectedDateFormat: "{0:D} - {1:D}",
selectedShortDateFormat: "{0:d} - {1:d}"
};
M.displayName = "KendoReactSchedulerWorkWeekView";
export {
M as WorkWeekView,
h as workWeekDefaultProps
};