Description
dateUtils provides absolute date formatting but no relative formatting. Contributors should add a formatRelative(date: Date, now?: Date): string function that returns human-readable strings like "just now", "2 minutes ago", "3 days ago", and "in 5 hours", capped at "over a year ago" / "over a year from now" for distant dates.
Acceptance Criteria
Context
- Target file:
src/lib/dateUtils.ts
- Do not import any third-party date library — implement purely with native
Date arithmetic
Description
dateUtilsprovides absolute date formatting but no relative formatting. Contributors should add aformatRelative(date: Date, now?: Date): stringfunction that returns human-readable strings like "just now", "2 minutes ago", "3 days ago", and "in 5 hours", capped at "over a year ago" / "over a year from now" for distant dates.Acceptance Criteria
formatRelativereturns "just now" for dates within 60 seconds ofnownowparameter (defaults tonew Date()) for testabilityContext
src/lib/dateUtils.tsDatearithmetic