diff --git a/packages/ui/core-components/src/lib/atoms/inputs/date-input/DateInput.svelte b/packages/ui/core-components/src/lib/atoms/inputs/date-input/DateInput.svelte index 3e0505d91..774f581ba 100644 --- a/packages/ui/core-components/src/lib/atoms/inputs/date-input/DateInput.svelte +++ b/packages/ui/core-components/src/lib/atoms/inputs/date-input/DateInput.svelte @@ -61,6 +61,14 @@ let currentDate = dateToYYYYMMDD(new Date()); + let extraDayEndString; + + $: if (endString) { + extraDayEndString = new Date(endString); + extraDayEndString.setDate(extraDayEndString.getDate() + 1); + extraDayEndString = formatDateString(extraDayEndString); + } + function onSelectedDateInputChange(selectedDateInput) { if (selectedDateInput && (selectedDateInput.start || selectedDateInput.end) && range) { $inputs[name] = { @@ -101,6 +109,7 @@ {onSelectedDateInputChange} start={startString} end={endString} + {extraDayEndString} loaded={loaded?.ready ?? true} {presetRanges} {defaultValue} diff --git a/packages/ui/core-components/src/lib/atoms/inputs/date-input/_DateInput.svelte b/packages/ui/core-components/src/lib/atoms/inputs/date-input/_DateInput.svelte index d5e12ea23..6eb9d91ff 100644 --- a/packages/ui/core-components/src/lib/atoms/inputs/date-input/_DateInput.svelte +++ b/packages/ui/core-components/src/lib/atoms/inputs/date-input/_DateInput.svelte @@ -49,7 +49,7 @@ export let range = false; /** @type {string} */ export let title; - export let extraDayEndString; + export let extraDayEndString = undefined; /** @type { { label: string, group: string, range: import('bits-ui').DateRange }[] } */ $: presets = [ diff --git a/packages/ui/core-components/src/lib/atoms/shadcn/range-calendar/range-calendar-day.svelte b/packages/ui/core-components/src/lib/atoms/shadcn/range-calendar/range-calendar-day.svelte index 49fd27f39..061a5036f 100644 --- a/packages/ui/core-components/src/lib/atoms/shadcn/range-calendar/range-calendar-day.svelte +++ b/packages/ui/core-components/src/lib/atoms/shadcn/range-calendar/range-calendar-day.svelte @@ -16,80 +16,40 @@ export let maxValue = undefined; - let hideDate = false; - - $: if ( - maxValue.day === date.day && - maxValue.month === date.month && - maxValue.year === date.year - ) { - hideDate = true; - } else { - hideDate = false; - } + $: hideExtraDay = + date.year >= maxValue.year && date.month >= maxValue.month && date.day >= maxValue.day + ? true + : false; -{#if hideDate} - - - {date.day} - - -{:else} - - - {date.day} - - -{/if} + + + {date.day} + +