import { type Maybe } from '../value'; import { type IsInSetDecisionFunction } from '../set/set.decision'; export type Sunday = 0; export type Monday = 1; export type Tuesday = 2; export type Wednesday = 3; export type Thusrsday = 4; export type Friday = 5; export type Saturday = 6; /** * Values that correspond to each day of the week. */ export type DayOfWeek = Sunday | Monday | Tuesday | Wednesday | Thusrsday | Friday | Saturday | Sunday; /** * Returns the day of the week for the input date. * * Equivalent to date.getDay(). * * @param date - Reference instant whose local weekday should be reported. * @returns Weekday for `date` indexed 0=Sunday through 6=Saturday. */ export declare function dayOfWeek(date: Date): DayOfWeek; /** * Decision function that checks whether or not the input DayOfWeek or the DayOfWeek for the input Date is in the set. */ export type IsInAllowedDaysOfWeekSetDecisionFunction = IsInSetDecisionFunction; /** * Creates a DecisionFunction that checks whether the input day or Date falls within the allowed days of the week. * * @param allowedDaysOfWeek - Set of allowed DayOfWeek values. * @returns Reusable predicate that yields true when a date or weekday falls in the allowed set. */ export declare function isInAllowedDaysOfWeekSet(allowedDaysOfWeek: Set): IsInAllowedDaysOfWeekSetDecisionFunction; /** * Returns all days of the week starting from the given day up to the specified number of days. * * Returns 7 days by default. * * @param startingOn - The day to start from (defaults to Sunday) * @param maxDays - Maximum number of days to return (defaults to 7) * @returns Successive weekdays beginning at `startingOn`, capped at `maxDays`. */ export declare function daysOfWeekArray(startingOn?: DayOfWeek, maxDays?: number): DayOfWeek[]; /** * Enum for the days of the week. */ export declare enum Day { SUNDAY = 0, MONDAY = 1, TUESDAY = 2, WEDNESDAY = 3, THURSDAY = 4, FRIDAY = 5, SATURDAY = 6 } /** * Object containing the name of every day and whether they're true/false. */ export interface EnabledDays { sunday: boolean; monday: boolean; tuesday: boolean; wednesday: boolean; thursday: boolean; friday: boolean; saturday: boolean; } /** * Creates an EnabledDays object from an iterable of Day enum values. * * @param input - Iterable of Day values to mark as enabled. * @returns Per-weekday flag record with `true` for every day present in `input`. */ export declare function enabledDaysFromDaysOfWeek(input: Maybe>): EnabledDays; /** * Converts an EnabledDays object to an array of Day enum values. * * @param input - Per-weekday flag record specifying which days are enabled. * @returns Weekdays whose flag is true, ordered Sunday through Saturday. */ export declare function daysOfWeekFromEnabledDays(input: Maybe): Day[]; /** * Configuration for transforming day-of-week name strings. */ export interface DayOfWeekNamesTransformConfig { /** * Whether or not to abbreviate the day names. * * I.E. Mon, Tue, etc. */ readonly abbreviation?: boolean; /** * Whether or not to uppercase the days. * * I.E. MONDAY, TUE, etc. */ readonly uppercase?: boolean; } /** * Returns an array of strings with each day of the week named. * * @param sundayFirst - If true (default), Sunday is the first day; otherwise Monday is first. * @param transform - Optional configuration for abbreviation and casing. * @returns Localized weekday labels ordered per `sundayFirst` and styled per `transform`. */ export declare function getDaysOfWeekNames(sundayFirst?: boolean, transform?: DayOfWeekNamesTransformConfig): string[]; /** * Creates a Map from DayOfWeek values to their string names. * * @param transform - Optional configuration for abbreviation and casing. * @returns Lookup pairing each weekday with its formatted name. */ export declare function daysOfWeekNameMap(transform?: DayOfWeekNamesTransformConfig): Map; /** * Function that returns the name string for a given DayOfWeek. */ export type DayOfWeekNameFunction = (dayOfWeek: DayOfWeek) => string; /** * Creates a function that returns the name for a given DayOfWeek. * * @param transform - Optional configuration for abbreviation and casing. * @returns Reusable resolver that maps a weekday to its formatted name (or 'UNKNOWN'). * * @dbxUtil * @dbxUtilCategory date * @dbxUtilKind factory * @dbxUtilTags date, week, day-of-week, name, factory, format * @dbxUtilRelated days-of-week-name-map * * @__NO_SIDE_EFFECTS__ */ export declare function daysOfWeekNameFunction(transform?: DayOfWeekNamesTransformConfig): DayOfWeekNameFunction; /** * Returns the DayOfWeek for the day after the given day. * * @param day - The starting day. * @returns The next day of the week. */ export declare function getDayTomorrow(day: DayOfWeek): DayOfWeek; /** * Returns the DayOfWeek for the day before the given day. * * @param day - The starting day. * @returns The previous day of the week. */ export declare function getDayYesterday(day: DayOfWeek): DayOfWeek; /** * Returns the DayOfWeek offset by the given number of days (positive = forward, negative = backward). * * @param day - Starting weekday from which to offset. * @param days - Signed step count (positive advances; negative rewinds). * @returns Weekday after applying the signed offset, wrapping at week boundaries. */ export declare function getDayOffset(day: DayOfWeek, days: number): DayOfWeek; /** * Returns the DayOfWeek that is the given number of days before the input day. * * @param day - Starting weekday from which to rewind. * @param days - Step count to walk backwards; defaults to 1. * @returns Weekday `days` positions earlier, wrapping at week boundaries. */ export declare function getPreviousDay(day: DayOfWeek, days?: number): DayOfWeek; /** * Returns the DayOfWeek that is the given number of days after the input day. * * @param day - Starting weekday from which to advance. * @param days - Step count to walk forwards; defaults to 1. * @returns Weekday `days` positions later, wrapping at week boundaries. */ export declare function getNextDay(day: DayOfWeek, days?: number): DayOfWeek;