-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: date picker core #11
base: v0
Are you sure you want to change the base?
Conversation
I'm just keeping a casual eye on the repo, so disregard me If you want, but this feels unintuitive to me. Datepicker inheriting from calendar feels backwards, as Calendar is obviously a bigger concept than date |
Thanks for your input, @Faithfinder! |
Well, I'm not saying it feels unrelated, I'm saying it feels backwards :) Anyway, it's not like I dove deep into code or decisions, I'll leave you alone now :) |
DatePicker Core
Summary
This RFC proposes the creation of a DatePickerCore class that extends the CalendarCore class to include additional functionalities for managing date selection. This includes single-date, multiple-date, and range selection modes. The DatePickerCore is designed for use in various date picker applications where precise date management and selection are required.
Motivation
The motivation behind this RFC is to provide a flexible and efficient core for date picker applications, enabling consistent and simplified management of date selection functionalities. By extending CalendarCore, this class leverages existing calendar functionalities while adding robust support for date selection, ensuring it can handle a variety of use cases such as single-date, multiple-date, and range selection.
The DatePickerCore class extends CalendarCore to provide additional functionalities for managing date selection, including single-date, multiple-date, and range selection modes. This class is designed to be used in various date picker applications where precise date management and selection are required.
Parameters
weekStartsOn?: number
events?: TEvent[]
viewMode: ViewMode
locale?: Parameters<Temporal.PlainDate['toLocaleString']>['0']
minDate?: Temporal.PlainDate
maxDate?: Temporal.PlainDate
selectedDates?: Temporal.PlainDate[]
multiple?: boolean
range?: boolean
Returns
getSelectedDates(): Temporal.PlainDate[]
selectDate(date: Temporal.PlainDate): void
getDaysWithEvents(): Array<Day<TEvent>>
getDaysNames(): string[]
changeViewMode(newViewMode: ViewMode): void
goToPreviousPeriod(): void
goToNextPeriod(): void
goToCurrentPeriod(): void
goToSpecificPeriod(date: Temporal.PlainDate): void
updateCurrentTime(): void
getEventProps(id: Event['id']): { style: CSSProperties } | null
getCurrentTimeMarkerProps(): { style: CSSProperties; currentTime: string | undefined }
groupDaysBy(props: Omit<GroupDaysByProps<TEvent>, 'weekStartsOn'>): (Day<TEvent> | null)[][]
Example Usage