Skip to content

Commit 705df0c

Browse files
danbimclaude
andcommitted
feat: show localized date+time alongside relative date on sites page
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 8e8aa25 commit 705df0c

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

app/routes/sites.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,7 @@ export async function action({ request }: Route.ActionArgs) {
8383
return { success: false }
8484
}
8585

86-
function formatLastChecked(date: string | null): string {
87-
if (!date) return 'Never'
88-
const now = new Date()
89-
const checked = new Date(date)
90-
const diffMs = now.getTime() - checked.getTime()
91-
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24))
92-
86+
function formatRelative(diffDays: number): string {
9387
if (diffDays <= 0) return 'Today'
9488
if (diffDays === 1) return 'Yesterday'
9589
if (diffDays < 7) return `${diffDays} days ago`
@@ -101,6 +95,19 @@ function formatLastChecked(date: string | null): string {
10195
return `${months} ${months === 1 ? 'month' : 'months'} ago`
10296
}
10397

98+
function formatLastChecked(date: string | null): string {
99+
if (!date) return 'Never'
100+
const checked = new Date(date)
101+
const diffMs = Date.now() - checked.getTime()
102+
const diffDays = Math.floor(diffMs / (1000 * 60 * 60 * 24))
103+
const relative = formatRelative(diffDays)
104+
const localized = checked.toLocaleString(undefined, {
105+
dateStyle: 'medium',
106+
timeStyle: 'short',
107+
})
108+
return `${relative} (${localized})`
109+
}
110+
104111
export default function Sites() {
105112
const { sites } = useLoaderData<typeof loader>()
106113
const [editSite, setEditSite] = useState<JobPostingSite | null>(null)

docs/screenshots/sites.png

8.22 KB
Loading

0 commit comments

Comments
 (0)