UNPKG

react-weekview

Version:

Week view component and hook for React

36 lines (35 loc) 1.09 kB
import { Day, Locale } from "date-fns"; export default function useWeekView({ initialDate, minuteStep, weekStartsOn, locale, disabledCell, disabledDay, disabledWeek, }?: { initialDate?: Date; minuteStep?: number; weekStartsOn?: Day; locale?: Locale; disabledCell?: (date: Date) => boolean; disabledDay?: (date: Date) => boolean; disabledWeek?: (startDayOfWeek: Date) => boolean; } | undefined): { nextWeek: () => void; previousWeek: () => void; goToToday: () => void; days: { date: Date; isToday: boolean; name: string; shortName: string; dayOfMonth: string; dayOfMonthWithZero: string; dayOfMonthWithSuffix: string; disabled: boolean; cells: { date: Date; hour: string; minute: string; hourAndMinute: string; disabled: boolean; }[]; }[]; weekNumber: string; viewTitle: string; }; export type Days = ReturnType<typeof useWeekView>["days"]; export type Cell = Days[number]["cells"][number];