- relativeTime(date: Date) helper toegevoegd aan lib/utils.ts - AuditWidget gebruikt nu gedeelde relativeTime in plaats van inline functie - CaddyWidget toont rode badge als soonest cert-expiry <30 dagen - app/page.tsx berekent expiringWarning voor CaddyInitial Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
16 lines
523 B
TypeScript
16 lines
523 B
TypeScript
import { clsx, type ClassValue } from "clsx"
|
|
import { twMerge } from "tailwind-merge"
|
|
|
|
export function cn(...inputs: ClassValue[]) {
|
|
return twMerge(clsx(inputs))
|
|
}
|
|
|
|
export function relativeTime(date: Date): string {
|
|
const diff = Date.now() - date.getTime()
|
|
const minutes = Math.floor(diff / 60_000)
|
|
if (minutes < 1) return 'net nu'
|
|
if (minutes < 60) return `${minutes}m geleden`
|
|
const hours = Math.floor(minutes / 60)
|
|
if (hours < 24) return `${hours}u geleden`
|
|
return `${Math.floor(hours / 24)}d geleden`
|
|
}
|