Format dates with the app's locale instead of toLocaleDateString()

オープン
#3,707 コメント 3 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@vaishnavi-codeworld がすでに取り組んでいます。

2026年11月26日 から。

  • #3924 @vaishnavi-codeworld による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
62/100
issue の種類
リファクタリング
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
nextjs, react, typescript

調査の方向性

Start by running the grep in the issue to list the 13 toLocaleDateString()/toLocaleString() calls, mostly in src/components/repo-analytics/, PRMetrics.tsx, GoalTracker.tsx and MilestonePlanner.tsx. Check how next-intl supplies the locale through useLocale() on the client and getLocale() on the server, then add the shared formatDate helper under src/lib/ using Intl.DateTimeFormat. Done when the grep returns nothing and the helper's unit tests pass, including a case near midnight UTC.

索引モデルが issue の本文から書いたものです。

説明

level 2 level:intermediate status:assigned type:refactor
Summary

13 places call toLocaleDateString() / toLocaleString() with no locale, so dates follow the browser's language, not the language picked in DevTrack, and the server and client can render different text (hydration warnings).

Where
grep -rnE "toLocale(Date|Time)?String\(\)" src --include=*.tsx

Most are in src/components/repo-analytics/, PRMetrics.tsx, GoalTracker.tsx and MilestonePlanner.tsx.

Expected outcome

A small shared helper (e.g. formatDate(date, locale, options) in src/lib/) built on Intl.DateTimeFormat, used everywhere, with the locale coming from next-intl (useLocale() on the client, getLocale() on the server). Pass timeZone: "UTC" wherever a date-only value is shown, so it doesn't shift by a day.

Acceptance criteria
  • No bare toLocale*String() calls left
  • Unit tests for the helper, including a date near midnight UTC
主要言語
TypeScript
スター
246
フォーク
436
平均マージ
9時間 33分
マージ済み PR(30日)
213

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Priyanshu-byte-coder/devtrack のほかの issue

Priyanshu-byte-coder/devtrack の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。