Skip to content

feat(routes-f): add word-of-the-day, contrast, timezone, and date-diff endpoints#637

Merged
davedumto merged 2 commits intoStreamFi-x:devfrom
CMI-James-OD:codex/routes-f-558-616-629-632
Apr 28, 2026
Merged

feat(routes-f): add word-of-the-day, contrast, timezone, and date-diff endpoints#637
davedumto merged 2 commits intoStreamFi-x:devfrom
CMI-James-OD:codex/routes-f-558-616-629-632

Conversation

@CMI-James
Copy link
Copy Markdown
Collaborator

Description

Implemented four new scoped API endpoints under app/api/routes-f/ for deterministic word selection, WCAG contrast validation, timezone conversion via Intl, and calendar-aware date differences.

Closes #558
Closes #616
Closes #629
Closes #632

Changes proposed

What were you told to do?

Add four routes-f API features (word-of-the-day, contrast checker, timezone converter, and date-diff calculator) with scoped helpers/types/tests under app/api/routes-f/**, then open one PR that closes all related issues.

What did I do?

Added word-of-the-day endpoint

  • Added GET /api/routes-f/word-of-the-day with deterministic UTC-date-based selection.
  • Added strict date validation (YYYY-MM-DD, range 1990-01-01 to 2100-12-31).
  • Bundled a local vocabulary dataset (366 entries) in the feature folder.
  • Added unit tests for required fields, determinism, and validation behavior.

Added WCAG contrast checker endpoint

  • Added POST /api/routes-f/contrast supporting hex and rgb() input parsing.
  • Implemented WCAG 2.1 relative luminance and contrast ratio calculation.
  • Returned rounded ratio (2 decimals) plus AA/AAA pass/fail flags for normal/large text.
  • Added tests using known reference pairs (including black/white = 21).

Added timezone conversion endpoint

  • Added GET /api/routes-f/timezone with timestamp, from (default UTC), and to params.
  • Validated timezone names with Intl.supportedValuesOf('timeZone').
  • Implemented conversion and DST-aware offsets using Intl.DateTimeFormat only.
  • Added DST spring-forward/fall-back test coverage and invalid timezone rejection tests.

Added date-diff endpoint with calendar math

  • Added POST /api/routes-f/date-diff supporting ISO input and optional unit.
  • Implemented calendar-aware breakdown across years/months/days/hours/minutes.
  • Added signed total_seconds and natural human strings for future/past cases.
  • Added leap-year, DST boundary, reverse-order, and invalid-unit tests.

Hook unblock fix needed for repository commit hooks

  • Fixed one pre-existing duplicate key in app/api/routes-f/word-frequency/_lib/corpus.ts (right duplicated), which was blocking enforced type-check hooks for any commit.

Check List (Check all the applicable boxes)

  • My code follows the code style of this project.
  • This PR does not contain plagiarized content.
  • The title and description of the PR is clear and explains the approach.
  • I am making a pull request against the main branch (left side).
  • My commit messages styles matches our requested structure.
  • My code additions will fail neither code linting checks nor unit test.
  • I am only making changes to files I was requested to.

Screenshots / Testing Evidence

  • Commit hooks executed npm run type-check and next build successfully during commit.
  • Endpoint route registration appears in Next build output for:
    • /api/routes-f/word-of-the-day
    • /api/routes-f/contrast
    • /api/routes-f/timezone
    • /api/routes-f/date-diff
  • Per user instruction, standalone test command execution was not run explicitly.

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 26, 2026

@CMI-James is attempting to deploy a commit to the chibuikemmichaelilonze's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Apr 26, 2026

@CMI-James Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@davedumto davedumto merged commit 7a7c476 into StreamFi-x:dev Apr 28, 2026
3 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants