Use locale to format dates and times (#123)

* Use deployment url in demo description.

Close #131
This commit is contained in:
Luke Vella 2022-04-26 20:10:59 +01:00 committed by GitHub
parent 8263926168
commit 8aec24308e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
40 changed files with 1240 additions and 864 deletions

View file

@ -24,6 +24,7 @@ interface HeadlessDatePickerOptions {
date?: Date;
selection?: Date[];
onNavigationChange?: (date: Date) => void;
weekStartsOn?: "monday" | "sunday";
}
const today = new Date();
@ -47,7 +48,9 @@ export const useHeadlessDatePicker = (
const navigationDate = options?.date ?? localNavigationDate;
const firstDayOfMonth = startOfMonth(navigationDate);
const firstDayOfFirstWeek = startOfWeek(firstDayOfMonth, { weekStartsOn: 1 });
const firstDayOfFirstWeek = startOfWeek(firstDayOfMonth, {
weekStartsOn: options?.weekStartsOn === "monday" ? 1 : 0,
});
const currentMonth = getMonth(navigationDate);