Skip to content

Commit

Permalink
escape interpolated dates
Browse files Browse the repository at this point in the history
  • Loading branch information
futurepaul committed Apr 12, 2024
1 parent 019d4d0 commit dda1601
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/GenericItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,11 @@ export function GenericItem(props: {
<div class="flex w-full items-center gap-1 text-m-grey-400">
<Clock4 class="w-3" />
<span class="text-xs text-m-grey-400">
{i18n.t("common.expires", { time: props.due })}
{/* the date might include slashes so we don't want to escape those */}
{i18n.t("common.expires", {
time: props.due,
interpolation: { escapeValue: false }
})}
</span>
</div>
</Show>
Expand Down
2 changes: 2 additions & 0 deletions src/utils/prettyPrintTime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export function veryShortTimeStamp(ts?: number | bigint) {
return `${elapsedHours}h`;
} else if (elapsedDays < 7) {
return `${elapsedDays}d`;
} else if (elapsedDays < 30) {
return `${Math.floor(elapsedDays / 7)}w`;
} else {
const date = new Date(timestamp);
const day = String(date.getDate()).padStart(2, "0");
Expand Down

0 comments on commit dda1601

Please sign in to comment.