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

Abierto
#3,707 3 comentarios 0 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@vaishnavi-codeworld ya está trabajando en esto.

Desde el 26/11/2026.

  • #3924 de @vaishnavi-codeworld — abierto

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
62/100
Tipo de issue
Refactorización
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
nextjs, react, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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
Lenguaje dominante
TypeScript
Estrellas
246
Forks
436
Merge medio
9 h 33 min
PR fusionados (30 d)
213

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de Priyanshu-byte-coder/devtrack

Todos los issues de Priyanshu-byte-coder/devtrack

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.