Date Validation
dateValidator
Validates a date value and returns validation result with a fallback date.MaybeDate
The date value to validate (can be Date, string, number, or null)
Date
Fallback date to return if validation fails
Date
The validated date or the default date if invalid
boolean
Whether the input date was valid
Date Conversion
toResolvedDate
Converts various date formats to a normalized UTC Date object.MaybeDate
default:"undefined"
The date value to resolve. If undefined, returns today’s date
- ISO date strings (e.g., “2024-01-15”)
- Unix timestamps
- Date objects
- Numeric strings
toDateString
Converts a Date object to ISO date string format (YYYY-MM-DD).Date
required
The date to convert to string
Date Calculations
toDayDiffInclusive
Calculates the number of days between two dates (inclusive).Date | number
required
Start date (Date object or timestamp)
Date | number
required
End date (Date object or timestamp)
isInCurrentMonth
Checks if a target date is in the same month and year as a source date.Date
required
The date to check
Date
required
The reference date
Formatting and Internationalization
toFormatters
Creates a complete set of internationalized date formatters for a given locale.string
required
BCP 47 language tag (e.g., “en-US”, “fr-FR”)
string
The locale string
DateTimeFormatter
Formats dates with weekday, month, and day (e.g., “Mon, Jan 15”)
DateTimeFormatter
Formats day numbers (e.g., “15”)
DateTimeFormatter
Formats complete dates (e.g., “Jan 15, 2024”)
DateTimeFormatter
Formats full month names (e.g., “January”)
DateTimeFormatter
Formats month and year (e.g., “January 2024”)
DateTimeFormatter
Formats full weekday names (e.g., “Monday”)
DateTimeFormatter
Formats single-letter weekdays (e.g., “M”)
DateTimeFormatter
Formats years (e.g., “2024”)
Calendar Generation
toMultiCalendars
Generates calendar data for multiple months with proper date validation.ToMultiCalendarsInit
required
Configuration object for calendar generation
Date
required
The focal date for calendar generation
string
required
BCP 47 language tag
DateTimeFormatter
required
Formatter for day numbers
DateTimeFormatter
required
Formatter for full dates
DateTimeFormatter
required
Formatter for weekday names
DateTimeFormatter
required
Formatter for narrow weekday labels
number
Number of months to generate (defaults to 1, always becomes odd number)
Date
Minimum selectable date
Date
Maximum selectable date
string
Comma-separated list of disabled dates
string
Comma-separated list of disabled weekdays (0-6)
number
First day of week (0 = Sunday, 1 = Monday, etc.)
boolean
Whether to show week numbers
string
Label for week number column
WeekNumberType
Type of week numbering system
Array<Calendar>
Array of calendar objects for each month
CalendarWeekday[]
Weekday header information
Set<number>
Set of disabled date timestamps
Set<number>
Set of disabled weekday numbers
string
Unique key for the calendar configuration
Navigation Helpers
toNextSelectableDate
Finds the next selectable date from a given date, respecting constraints.Date
required
Starting date
SupportedKey
required
Navigation key pressed (e.g., ArrowRight, ArrowDown)
number
required
Minimum timestamp allowed
number
required
Maximum timestamp allowed
Set<number>
required
Set of disabled date timestamps
Set<number>
required
Set of disabled weekday numbers
List Generation
toYearList
Generates an array of years between min and max dates.Date
required
Minimum date
Date
required
Maximum date
String Utilities
splitString
Splits a string and optionally transforms each element.string
required
String to split
SplitStringCallbackFn<ReturnType>
Optional transformation function for each element
RegExp | string
default:"/,\\s*/"
Separator pattern (comma with optional space by default)
Utility Functions
clampValue
Clamps a value between minimum and maximum bounds.number
required
Minimum value
number
required
Maximum value
number
required
Value to clamp
focusElement
Focuses an element after resolving a promise.Promise<T>
required
Promise that resolves to an HTML element
function
Optional callback to execute after focusing
toClosestTarget
Finds the closest ancestor element matching a selector from an event.Event
required
The event object
string
required
CSS selector to match