Skip to content

Commit 6a140f3

Browse files
committed
feat: just use since for last cache update time in cache status
Signed-off-by: Matt Gleich <git@mattglei.ch>
1 parent 03887a1 commit 6a140f3

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/lib/time.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import advancedFormat from 'dayjs/plugin/advancedFormat';
66
dayjs.extend(duration);
77
dayjs.extend(advancedFormat);
88

9-
export function renderDate(date: Dayjs, now: Dayjs, lowercaseDayOfWeek: boolean = false): string {
9+
export function renderDate(date: Dayjs, now: Dayjs): string {
1010
const dayjsDate = dayjs(date);
1111
const yesterday = now.subtract(1, 'day');
1212
const tomorrow = now.add(1, 'day');
@@ -17,19 +17,19 @@ export function renderDate(date: Dayjs, now: Dayjs, lowercaseDayOfWeek: boolean
1717
now.year() === dayjsDate.year() &&
1818
now.month() === dayjsDate.month()
1919
) {
20-
dayOfWeek = lowercaseDayOfWeek ? 'today' : 'Today';
20+
dayOfWeek = 'Today';
2121
} else if (
2222
yesterday.date() === dayjsDate.date() &&
2323
yesterday.year() === dayjsDate.year() &&
2424
yesterday.month() === dayjsDate.month()
2525
) {
26-
dayOfWeek = lowercaseDayOfWeek ? 'yesterday' : 'Yesterday';
26+
dayOfWeek = 'Yesterday';
2727
} else if (
2828
tomorrow.date() === dayjsDate.date() &&
2929
tomorrow.year() === dayjsDate.year() &&
3030
tomorrow.month() === dayjsDate.month()
3131
) {
32-
dayOfWeek = lowercaseDayOfWeek ? 'tomorrow' : 'Tomorrow';
32+
dayOfWeek = 'Tomorrow';
3333
} else {
3434
dayOfWeek = dayjsDate.format('dddd, MMM Do');
3535
}

src/lib/time/formatted-date.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
dayjs.extend(utc);
99
dayjs.extend(timezonePlugin);
1010
11-
const { time, lowercase = false }: { time: Date; lowercase?: boolean } = $props();
11+
const { time }: { time: Date } = $props();
1212
1313
let dayjsTime = dayjs(time);
1414
let now = $state(dayjs());
@@ -23,4 +23,4 @@
2323
});
2424
</script>
2525

26-
{renderDate(dayjsTime, now, lowercase)} [{fromNow(dayjsTime, now)}]
26+
{renderDate(dayjsTime, now)} [{fromNow(dayjsTime, now)}]

src/routes/writing/lcp/cache-status.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
22
import RefreshIcon from '$lib/icons/refresh-icon.svelte';
3-
import FormattedDate from '$lib/time/formatted-date.svelte';
3+
import Since from '$lib/time/since.svelte';
44
import { Card } from '@gleich/ui';
55
66
const {
@@ -29,7 +29,7 @@
2929
</div>
3030
<div class="updated">
3131
{#if updated}
32-
Updated <FormattedDate lowercase time={updated} />
32+
Updated <Since time={updated} />
3333
{:else}
3434
Cache is currently offline
3535
{/if}

0 commit comments

Comments
 (0)