fix: automation Once schedule defaults to the wrong day outside UTC (#32193)

The Once schedule in the automation dialog filled in today's date in UTC but the browser's local time. When the browser's date differs from UTC's, the default was a day off: east of UTC it was yesterday, so Create failed with "RRULE has no future occurrences", and west of UTC it was tomorrow, so the automation ran a day late. The earliest selectable date had the same mix-up, so west of UTC today could not be picked. The default date and the earliest selectable date now both use the browser's local date.

Fixes #31999
This commit is contained in:
Classic298 2026-10-10 18:09:40 +02:00 • committed by GitHub
parent 9b3d599c75
commit 8aa61fcd6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1,6 +1,7 @@
<script lang="ts">
import type i18nType from '$lib/i18n';
import { getContext } from 'svelte';
import dayjs from 'dayjs';
import Dropdown from '$lib/components/common/Dropdown.svelte';
@ -52,7 +53,7 @@
$: if (frequency === 'ONCE' && !onceDate) {
const soon = new Date(Date.now() + 5 * 60_000);
onceDate = soon.toISOString().split('T')[0];
onceDate = dayjs(soon).format('YYYY-MM-DD');
onceTime = `${String(soon.getHours()).padStart(2, '0')}:${String(soon.getMinutes()).padStart(2, '0')}`;
}
@ -233,7 +234,7 @@
<input
type="date"
bind:value={onceDate}
min={new Date().toISOString().split('T')[0]}
min={dayjs().format('YYYY-MM-DD')}
class="bg-transparent outline-hidden text-xs dark:scheme-dark"
on:click={(e) => e.stopPropagation()}
on:input={onChange}