style: fix prefer-svelte-reactivity — replace with Svelte reactive equivalents

This commit is contained in:
2026-06-25 14:40:22 +01:00
parent d5e93b3be2
commit 334b911e16
11 changed files with 35 additions and 29 deletions
@@ -104,15 +104,15 @@
/** Return the current London date as a Date set to midnight in the local timezone.
* Uses Intl.DateTimeFormat with Europe/London to handle BST/GMT correctly. */
function getLondonToday(): Date {
const dateStr = new Date().toLocaleDateString('en-CA', { timeZone: 'Europe/London' });
return new Date(dateStr + 'T00:00:00');
const dateStr = new SvelteDate().toLocaleDateString('en-CA', { timeZone: 'Europe/London' });
return new SvelteDate(dateStr + 'T00:00:00');
}
/** Return the current time-of-day in London as minutes since midnight, using
* Intl.DateTimeFormat with Europe/London so the current-time blue line is
* positioned correctly regardless of the browser's system timezone. */
function getLondonNowMinutes(): number {
const timeStr = new Date().toLocaleTimeString('en-GB', {
const timeStr = new SvelteDate().toLocaleTimeString('en-GB', {
timeZone: 'Europe/London',
hour: '2-digit',
minute: '2-digit',
@@ -127,7 +127,7 @@
* at 23:30 UTC (00:30 BST next day) are grouped under the correct
* London date column rather than the UTC date. */
function getLondonDateKey(iso: string): string {
return new Date(iso).toLocaleDateString('en-CA', { timeZone: 'Europe/London' });
return new SvelteDate(iso).toLocaleDateString('en-CA', { timeZone: 'Europe/London' });
}
function formatWeekLabel(start: Date): string {
@@ -316,7 +316,7 @@
function navigateWeek(delta: number) {
if (!weekStart) return;
const d = new Date(weekStart);
const d = new SvelteDate(weekStart);
d.setDate(d.getDate() + delta * 7);
weekStart = d;
}