- **refactor(main):** migrate static HTML to React components
- **feat(ui):** implement `AcknowledgeButton` component for acknowledging images - **feat(stats):** add dashboard stats for total images, pending updates, and acknowledged status - **chore(deps):** introduce `bun` dependency management and add required libraries - **style(ui):** enhance UI with Tailwind-based components and modularity improvements - **chore:** add drag-and-drop tag assignment using `@dnd-kit/core`
This commit is contained in:
17
frontend/src/lib/time.ts
Normal file
17
frontend/src/lib/time.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
export function timeAgo(iso: string): string {
|
||||
const now = Date.now()
|
||||
const then = new Date(iso).getTime()
|
||||
const diff = Math.floor((now - then) / 1000)
|
||||
|
||||
if (diff < 60) return 'just now'
|
||||
if (diff < 3600) {
|
||||
const m = Math.floor(diff / 60)
|
||||
return `${m} minute${m !== 1 ? 's' : ''} ago`
|
||||
}
|
||||
if (diff < 86400) {
|
||||
const h = Math.floor(diff / 3600)
|
||||
return `${h} hour${h !== 1 ? 's' : ''} ago`
|
||||
}
|
||||
const d = Math.floor(diff / 86400)
|
||||
return `${d} day${d !== 1 ? 's' : ''} ago`
|
||||
}
|
||||
Reference in New Issue
Block a user