date picker fix

This commit is contained in:
Estifo77
2026-08-10 12:21:40 +03:00
parent 8ce6a2fa94
commit e93b439d50
2 changed files with 9 additions and 0 deletions

View File

@@ -77,6 +77,8 @@
display: flex; display: flex;
align-items: center; align-items: center;
height: var(--rdp-nav-height); height: var(--rdp-nav-height);
z-index: 10;
pointer-events: none;
} }
.amharic-daypicker .rdp-button_previous, .amharic-daypicker .rdp-button_previous,
@@ -88,6 +90,9 @@
height: var(--rdp-nav_button-height); height: var(--rdp-nav_button-height);
padding: 0; padding: 0;
margin: 0; margin: 0;
position: relative;
z-index: 10;
pointer-events: auto;
} }
.amharic-daypicker .rdp-dropdowns { .amharic-daypicker .rdp-dropdowns {
@@ -154,6 +159,7 @@
.amharic-daypicker .rdp-month_caption { .amharic-daypicker .rdp-month_caption {
font-size: inherit; font-size: inherit;
font-weight: 600; font-weight: 600;
margin-inline-end: calc(var(--rdp-nav_button-width) * 2 + 0.5rem);
} }
/* Day cells are already circular (--rdp-day_button-border-radius: 100%); /* Day cells are already circular (--rdp-day_button-border-radius: 100%);

View File

@@ -154,6 +154,7 @@ export function toGregorianDateLabel(date: Date | string): string {
return d.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' }); return d.toLocaleDateString('en-US', { year: 'numeric', month: 'long', day: 'numeric' });
} }
const YEAR_DROPDOWN_START = new Date(new Date().getFullYear() - 100, 0, 1);
const YEAR_DROPDOWN_END = new Date(new Date().getFullYear() + 50, 11, 31); const YEAR_DROPDOWN_END = new Date(new Date().getFullYear() + 50, 11, 31);
export interface AmharicDatePickerProps { export interface AmharicDatePickerProps {
@@ -291,6 +292,7 @@ export function AmharicDatePicker({
mode="single" mode="single"
selected={selected ?? undefined} selected={selected ?? undefined}
defaultMonth={selected ?? undefined} defaultMonth={selected ?? undefined}
startMonth={YEAR_DROPDOWN_START}
endMonth={YEAR_DROPDOWN_END} endMonth={YEAR_DROPDOWN_END}
numerals="latn" numerals="latn"
captionLayout="dropdown" captionLayout="dropdown"
@@ -306,6 +308,7 @@ export function AmharicDatePicker({
mode="single" mode="single"
selected={selected ?? undefined} selected={selected ?? undefined}
defaultMonth={selected ?? undefined} defaultMonth={selected ?? undefined}
startMonth={YEAR_DROPDOWN_START}
endMonth={YEAR_DROPDOWN_END} endMonth={YEAR_DROPDOWN_END}
captionLayout="dropdown" captionLayout="dropdown"
onSelect={(date: Date | undefined) => { onSelect={(date: Date | undefined) => {