Skip to content

Commit

Permalink
override max date in public url form
Browse files Browse the repository at this point in the history
  • Loading branch information
lovincyrus committed Jan 28, 2025
1 parent baa6274 commit 6c0f6cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions web-admin/src/features/public-urls/CreatePublicURLForm.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,17 @@
hasDashboardDimensionThresholdFilter($dashboardStore);
$: if (setExpiration && $form.expiresAt === null) {
// When `setExpiration` is toggled, initialize the expiration time to 60 days from today
$form.expiresAt = DateTime.now().plus({ days: 60 }).toISO();
$form.expiresAt = includingTomorrowDate.toISO();
popoverOpen = true;
} else if (!setExpiration) {
$form.expiresAt = null;
popoverOpen = false;
}
$: ({ length: allErrorsLength } = $allErrors);
$: includingTomorrowDate = DateTime.now().plus({ days: 1 }).startOf("day");
$: maxExpirationDate = DateTime.now().plus({ years: 1 }).startOf("day");
</script>

{#if !url}
Expand Down Expand Up @@ -187,6 +189,7 @@
selection={DateTime.fromISO($form.expiresAt)}
singleDaySelection
minDate={includingTomorrowDate}
maxDate={maxExpirationDate}
firstVisibleMonth={DateTime.fromISO($form.expiresAt)}
onSelectDay={(date) => {
$form.expiresAt = date.toISO();
Expand Down
2 changes: 1 addition & 1 deletion web-common/src/components/date-picker/Calendar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
export let selection: MaybeDate | Interval = undefined;
export let minDate: MaybeDate = undefined;
export let maxDate: MaybeDate = DateTime.now().startOf("day");
export let maxDate: MaybeDate = undefined;
export let visibleMonths = 1;
export let selectingStart = true;
export let firstVisibleMonth: MaybeDate = isValidDateTime(selection)
Expand Down

0 comments on commit 6c0f6cf

Please sign in to comment.