Skip to content

Guard relativeTime against invalid createdAt #5

Description

@royalpinto007

Problem

relativeTime("garbage") renders "NaNm ago" (Math.max(1, NaN) is NaN).

Where

app/index.tsx (relativeTime, no validity check on the parsed date).

Acceptance

Add a failing test first with an invalid createdAt, expecting a fallback like "recently" instead of a string containing "NaN". Then fix.

Note: this repo has no test runner configured yet. Setting up a minimal vitest (or equivalent) config is part of this issue.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions