Skip to content

DJ-72: Deduplicate raw date formatting into shared formatDate util - #211

Open
devin-ai-integration[bot] wants to merge 1 commit into
migration/in-progressfrom
DJ-72/dedupe-date-formatting
Open

DJ-72: Deduplicate raw date formatting into shared formatDate util#211
devin-ai-integration[bot] wants to merge 1 commit into
migration/in-progressfrom
DJ-72/dedupe-date-formatting

Conversation

@devin-ai-integration

Copy link
Copy Markdown

Summary

Fixes DJ-72. The raw new Date(x.createdAt).toDateString() expression ("Thu Jul 30 2026") was copy-pasted in ArticlePreview, ArticleMeta, and Comment. Added frontend/lib/utils/formatDate.ts:

const formatDate = (iso: string): string =>
  new Date(iso).toLocaleDateString("en-US", { year: "numeric", month: "long", day: "numeric" });

All three components now use formatDate(...), rendering dates like "July 30, 2026". No new dependencies; no toDateString() calls remain in frontend/components.

Verified with npm run build and by running backend + frontend locally.

Before

before

After

after

Article page after:
article after

Link to Devin session: https://partner-workshops.devinenterprise.com/sessions/824a22b5019349bc9ea2b2b07ca45e05

@devin-ai-integration

Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants