Slot dates and times can only be shown in US English

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

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

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
38/100
issue の種類
機能追加
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
node.js, typescript

調査の方向性

Start with src/lib/slot-label.ts and trace its callers listed in the issue, then inspect the other formatting sites in src/lib/magic-compose/fit-text.ts, src/lib/format-duration.ts, and the connected-apps page. Add locale-focused unit tests for unchanged English output and Swedish formatting, including a date-only value under a non-UTC TZ; run tests/e2e/time-format.spec.ts unchanged. Done means the listed checks pass; the Dockerfile ICU change requires owner handling.

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

説明

enhancement pipeline:proposed

Needs your OK: this lets slot dates and times be formatted for any language. English output stays exactly the same. Swap pipeline:proposed for pipeline:ready to have it built.

What happens

src/lib/slot-label.ts formats every slot date with toLocaleDateString('en-US', …) ("Sat, May 3") and every time on a hand-written 12-hour clock ("18:30" → "6:30 PM"). A Swedish reader expects "lör 3 maj" and "18:30".

The same functions run on the server (public page, Responses tab, emails), in the browser (Build tab) and in the worker (reminders). Services call them too: summarizeSlotValues names the slot for the edit and cancelled pages from src/services/commitments.ts.

Three other places format on their own:

  • src/app/app/(chrome)/settings/connected-apps/page.tsx uses en-GB dates.
  • src/lib/magic-compose/fit-text.ts uses an en-US number.
  • src/lib/format-duration.ts builds English plurals.

Fix, in outline

  • formatSlotDate(iso, locale) and formatSlotTime(hhmm, locale), with locale required, so TypeScript finds every caller: renderFieldValue, slotDetails, summarizeSlotValues, formatGroupLabel, prettyHeader, WysiwygSlot, the Responses tab, the emails, and the commitment services, which take locale as a parameter. Every caller passes 'en' for now.
  • No time zone can shift the output. Build the Date from UTC parts and format with timeZone: 'UTC'.
  • English keeps today's exact output, including the no-break space before AM/PM. Other languages use Intl; Swedish gives "lör 3 maj" and "18:30".
  • The other three spots take a locale too: Intl.NumberFormat in fit-text.ts, Intl dates on the connected-apps page, and a formatDuration that can pluralize per language.
  • Full ICU in the image. Add a RUN node -e line to the Dockerfile that fails the build unless Intl.DateTimeFormat('sv').resolvedOptions().locale === 'sv'. CI's Node isn't the image's, so CI can't check this.

Watch for

  • tests/e2e/time-format.spec.ts pins "6:30 PM", and must pass unchanged.
  • The CSV export isn't a caller. It exports raw values on purpose (src/lib/responses-csv.ts).
  • Hydration, later. Node's ICU and Chrome's can abbreviate differently ("lör" vs "lör."). That can't bite while everything passes 'en'; later steps format on the server where they can.
  • The Dockerfile change goes to the owner, as a high-risk file.
  • #319 (local times treated as UTC) is related but separate: this only changes how a stored value is printed.

Done when

  • Unit tests cover English (unchanged strings) and Swedish dates and times, including a date-only value run under a non-UTC TZ.
  • time-format.spec.ts passes unchanged.
  • pnpm lint && pnpm typecheck && pnpm knip && pnpm test and pnpm test:db (services change) pass.

Planned with the owner in https://claude.ai/code/session_01EFKmj716ZY3b3SwR8TV8Y2 and checked against the code on main at 35288fa. The full plan is private to the owner's account: https://claude.ai/artifact/VgQH6U2s2EVx3LX991fJi8 (a Claude session on that account can open it with the Artifact tool's read action). This is step 0.3 there.

主要言語
TypeScript
スター
19
フォーク
4
平均マージ
21時間 41分
マージ済み PR(30日)
201

環境構築

はじめの一歩

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

richshaw/OpenSignup のほかの issue

richshaw/OpenSignup の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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