Skip to main content
The app-datepicker library is written in TypeScript and provides comprehensive type definitions. This page documents the key types and interfaces you’ll use when working with the library in TypeScript projects.

Core Component Types

DatePickerProperties

Complete type definition for all date picker properties.
This interface combines all property types for the main <app-datepicker> component. It includes:
  • Min/max date constraints
  • Localization and formatting options
  • Accessibility labels
  • Event handlers
Source: src/typings.ts:36-39

DatePickerMinMaxProperties

Properties for date range constraints.
string
Minimum selectable date in ISO format (YYYY-MM-DD)
string
Maximum selectable date in ISO format (YYYY-MM-DD)
Source: src/mixins/typings.ts:6-9

DatePickerMixinProperties

Core configuration properties for the date picker.
string
BCP 47 language tag (e.g., “en-US”, “fr-FR”, “ja-JP”)
string | null
Selected date value in ISO format (YYYY-MM-DD)
number
First day of week (0 = Sunday, 1 = Monday, …, 6 = Saturday)
StartView
Initial view to display (“calendar” or “yearGrid”)
string
Comma-separated list of disabled dates (e.g., “2024-01-01, 2024-12-25”)
string
Comma-separated list of disabled weekdays (e.g., “0,6” for Sunday and Saturday)
boolean
Whether to display week numbers
WeekNumberType
Week numbering system (“first-4-day-week”, “first-day-of-year”, “first-full-week”)
All label properties (e.g., todayLabel, nextMonthLabel) are for accessibility and internationalization. Source: src/mixins/typings.ts:11-31

Event Types

CustomEventDetail

Type map for all custom events dispatched by the date picker.
Each property maps an event name to its detail structure. Usage Example:
Source: src/typings.ts:17-21

ValueUpdatedEvent

Event detail for value update events.
string
The new date value in ISO format
boolean
Whether the update was triggered by keyboard
SupportedKey
The key that triggered the update (if isKeypress is true)
Source: src/typings.ts:80-82

Formatting Types

Formatters

Complete set of date formatters for a locale.
Each formatter is a function that takes a Date and returns a formatted string. Usage Example:
Source: src/typings.ts:43-52

View Types

StartView

The initial view mode for the date picker.
Possible values:
  • "calendar" - Shows the month calendar view
  • "yearGrid" - Shows the year selection grid
Usage Example:
Source: src/typings.ts:63-65

Helper Function Types

MaybeDate

Flexible type for date values that can be in various formats.
Accepts:
  • Date objects
  • null for no date
  • number for timestamps
  • string for ISO date strings
Usage Example:
Source: src/helpers/typings.ts:12

DateValidatorResult

Return type for date validation operations.
Date
The validated date or fallback date if invalid
boolean
Whether the input date was valid
Usage Example:
Source: src/helpers/typings.ts:7-10

MultiCalendars

Data structure for multiple calendar months.
Array
Array of calendar data for each month
CalendarWeekday[]
Weekday header information
Set<number>
Set of all disabled date timestamps across calendars
Set<number>
Set of all disabled weekday numbers
string
Unique key for the calendar configuration
Source: src/helpers/typings.ts:14-17

SupportedKey

Keyboard keys supported for date navigation.
Supported navigation keys:
  • Arrow keys: Navigate between dates
  • Home/End: Jump to start/end of week or month
  • PageUp/PageDown: Navigate between months
  • Enter/Space: Select date
  • Tab: Focus navigation
Source: src/typings.ts:67-78

ToNextSelectableDateInit

Configuration for finding the next selectable date.
Date
required
Starting date
SupportedKey
required
Navigation key pressed
number
required
Minimum allowed timestamp
number
required
Maximum allowed timestamp
Set<number>
required
Set of disabled date timestamps
Set<number>
required
Set of disabled weekday numbers (0-6)
Source: src/helpers/typings.ts:35-42

Extended Component Types

DatePickerInputProperties

Properties for the <app-datepicker-input> component.
Combines date picker properties with Material Web Components TextField properties. Source: src/date-picker-input/typings.ts:5

DatePickerDialogProperties

Properties for the <app-datepicker-dialog> component.
string
required
Label for the confirm button
string
required
Label for the dismiss button
string
required
Label for the reset button
() => void
required
Method to show the dialog
() => void
required
Method to hide the dialog
Source: src/date-picker-dialog/typings.ts:7-13

DialogClosingEventDetail

Event detail for dialog closing events.
DialogClosingEventDetailAction
The action that closed the dialog:
  • "set" - User confirmed date selection
  • "cancel" - User dismissed the dialog
  • "reset" - User reset the date picker
Usage Example:
Source: src/date-picker-dialog/typings.ts:17-21

Utility Types

Constructor

Type for class constructors.
Used internally for mixin patterns. Source: src/utility-typings.ts:8

ChangedProperties

Type for tracking property changes in Lit elements.
Used in lifecycle methods like updated() to track which properties changed. Source: src/typings.ts:10

InferredFromSet

Utility type to infer the element type from a Set.
Source: src/typings.ts:54

Import Paths

Import type definitions from their respective modules:

Type-Safe Component Usage

Here’s a complete example of using types for full type safety: