Skip to content
This repository was archived by the owner on Apr 21, 2025. It is now read-only.

Commit dda1601

Browse files
committed
escape interpolated dates
1 parent 019d4d0 commit dda1601

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/components/GenericItem.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,11 @@ export function GenericItem(props: {
112112
<div class="flex w-full items-center gap-1 text-m-grey-400">
113113
<Clock4 class="w-3" />
114114
<span class="text-xs text-m-grey-400">
115-
{i18n.t("common.expires", { time: props.due })}
115+
{/* the date might include slashes so we don't want to escape those */}
116+
{i18n.t("common.expires", {
117+
time: props.due,
118+
interpolation: { escapeValue: false }
119+
})}
116120
</span>
117121
</div>
118122
</Show>

src/utils/prettyPrintTime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@ export function veryShortTimeStamp(ts?: number | bigint) {
6363
return `${elapsedHours}h`;
6464
} else if (elapsedDays < 7) {
6565
return `${elapsedDays}d`;
66+
} else if (elapsedDays < 30) {
67+
return `${Math.floor(elapsedDays / 7)}w`;
6668
} else {
6769
const date = new Date(timestamp);
6870
const day = String(date.getDate()).padStart(2, "0");

0 commit comments

Comments
 (0)