@zag-js/date-utils
Version:
Date utilities for zag.js
24 lines (21 loc) • 1.12 kB
text/typescript
import { CalendarDate, CalendarDateTime, ZonedDateTime, DateFormatter } from '@internationalized/date';
type DateValue = CalendarDate | CalendarDateTime | ZonedDateTime;
type DateGranularity = "day" | "hour" | "minute" | "second";
type DateAlignment = "start" | "end" | "center";
type GetFormatterFn = (options: Intl.DateTimeFormatOptions) => DateFormatter;
type DateAvailableFn = (date: DateValue, locale: string) => boolean;
type GetPlaceholderFn = (options: {
field: string;
locale: string;
}) => string;
type DateAdjustFn = (options: {
startDate: DateValue;
focusedDate: DateValue;
}) => {
startDate: DateValue;
focusedDate: DateValue;
endDate: DateValue;
};
type DateFormatOptions = Intl.ResolvedDateTimeFormatOptions;
type DateRangePreset = "thisWeek" | "lastWeek" | "thisMonth" | "lastMonth" | "thisQuarter" | "lastQuarter" | "thisYear" | "lastYear" | "last3Days" | "last7Days" | "last14Days" | "last30Days" | "last90Days";
export type { DateAdjustFn, DateAlignment, DateAvailableFn, DateFormatOptions, DateGranularity, DateRangePreset, DateValue, GetFormatterFn, GetPlaceholderFn };