Skip to content

fix(admin): localize date pickers for Danish and Georgian - #3655

Merged
ascorbic merged 1 commit into
mainfrom
noah/angry-matsumoto-0330a5
Sep 30, 2026
Merged

ascorbic merged 1 commit into
mainfrom
noah/angry-matsumoto-0330a5

Conversation

@khoinguyenpham04

Copy link
Copy Markdown
Collaborator

What does this PR do?

Danish (da) and Georgian (ka) are enabled admin languages, but DAY_PICKER_LOCALES in packages/admin/src/locales/day-picker.ts had no entry for them, so getDayPickerLocale fell back to enUS. Admins using either language saw English month and day names, English screen reader labels, and weeks starting on Sunday in every admin date picker: the publish scheduling and publication date dialogs (PublishingDateTimeEditor.tsx) and the content list's date range filter (ContentList.tsx).

This maps both codes to react-day-picker's da and ka locales, which wrap the date-fns locales with translated DayPicker labels. Both start the week on Monday.

The new test in packages/admin/tests/locales/day-picker.test.ts checks every enabled non-English admin locale in SUPPORTED_LOCALES (excluding pseudo) and fails when getDayPickerLocale returns enUS, so a language enabled without a date-picker mapping fails CI. Korean is still disabled, so it isn't mapped here; the test will require a mapping when it's enabled.

No linked issue.

Type of change

  • Bug fix
  • Feature (requires maintainer-approved Discussion)
  • Refactor (no behavior change)
  • Translation
  • Documentation
  • Performance improvement
  • Tests
  • Chore (dependencies, CI, tooling)

Checklist

  • I have read CONTRIBUTING.md
  • pnpm typecheck passes
  • pnpm lint passes
  • pnpm test passes (or targeted tests for my change)
  • pnpm format has been run
  • I have added/updated tests for my changes (if applicable)
  • User-visible strings in the admin UI are wrapped for translation (if applicable). Do not include messages.po changes except in translation PRs — a workflow extracts catalogs on merge to main. — n/a: this PR adds or changes no strings.
  • I have added and reviewed the user-facing changeset (if this PR changes a published package)
  • New features link to an approved Discussion: https://github.com/emdash-cms/emdash/discussions/... — n/a: bug fix.
  • I have included screenshots below if this PR changes the UI

AI-generated code disclosure

  • This PR includes AI-generated code — model/tool: Claude Opus 5.5 (Claude Code)

Screenshots / test output

The publish scheduling dialog with the admin set to Danish. The calendar shows Danish month and day names and starts the week on Monday:

Publish scheduling dialog in the Danish admin, with the calendar showing "september 2026" and weekdays from "ma" to "sø", starting on Monday

The same dialog with the admin set to Georgian:

Publish scheduling dialog in the Georgian admin, with the calendar showing "სექტემბერი 2026" and Georgian weekday names, starting on Monday

Before this change, both languages rendered these calendars with English month and day names and a Sunday week start.

The new test (Vitest, Node environment), run against the pre-fix map and then with the fix:

# pre-fix map
 ❯ tests/locales/day-picker.test.ts (27 tests | 2 failed)
     × does not fall back to the English calendar for 'da'
     × does not fall back to the English calendar for 'ka'
      Tests  2 failed | 25 passed (27)

# with the fix
 ✓ tests/locales/day-picker.test.ts (27 tests)
      Tests  27 passed (27)

Danish and Georgian were enabled without a react-day-picker locale
mapping, so every Kumo DatePicker in the admin (publish scheduling,
publication date, and the content list's date range filter) fell back
to enUS: English month and day names and a Sunday week start.

Map da and ka to their react-day-picker locales. Add a test that every
enabled non-English admin locale maps to a calendar locale other than
enUS, so a language enabled without a mapping fails CI.
@changeset-bot

changeset-bot Bot commented Sep 29, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3a71680

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 12 packages
Name Type
@emdash-cms/admin Patch
emdash Patch
@emdash-cms/cloudflare Patch
@emdash-cms/plugin-test Patch
@emdash-cms/sandbox-workerd Patch
@emdash-cms/auth Patch
@emdash-cms/blocks Patch
create-emdash Patch
@emdash-cms/gutenberg-to-portable-text Patch
@emdash-cms/x402 Patch
@emdash-cms/auth-atproto Patch
@emdash-cms/plugin-embeds Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://noah-angry-matsumoto-0330a5.try.emdashcms.com, https://noah-angry-matsumoto-0330a5-emdash-playground.emdash-cms.workers.dev (commit 3a71680)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://0bcffdc1.try.emdashcms.com, https://0bcffdc1-emdash-playground.emdash-cms.workers.dev 3a71680 2026-09-29T19:08:30.426Z Visit the dashboard ↗

@pkg-pr-new

pkg-pr-new Bot commented Sep 29, 2026

Copy link
Copy Markdown

Open in StackBlitz

@emdash-cms/admin

npm i https://pkg.pr.new/@emdash-cms/admin@3655

@emdash-cms/auth

npm i https://pkg.pr.new/@emdash-cms/auth@3655

@emdash-cms/auth-atproto

npm i https://pkg.pr.new/@emdash-cms/auth-atproto@3655

@emdash-cms/blocks

npm i https://pkg.pr.new/@emdash-cms/blocks@3655

@emdash-cms/cloudflare

npm i https://pkg.pr.new/@emdash-cms/cloudflare@3655

@emdash-cms/contentful-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/contentful-to-portable-text@3655

emdash

npm i https://pkg.pr.new/emdash@3655

create-emdash

npm i https://pkg.pr.new/create-emdash@3655

@emdash-cms/gutenberg-to-portable-text

npm i https://pkg.pr.new/@emdash-cms/gutenberg-to-portable-text@3655

@emdash-cms/plugin-cli

npm i https://pkg.pr.new/@emdash-cms/plugin-cli@3655

@emdash-cms/plugin-test

npm i https://pkg.pr.new/@emdash-cms/plugin-test@3655

@emdash-cms/plugin-types

npm i https://pkg.pr.new/@emdash-cms/plugin-types@3655

@emdash-cms/registry-client

npm i https://pkg.pr.new/@emdash-cms/registry-client@3655

@emdash-cms/registry-lexicons

npm i https://pkg.pr.new/@emdash-cms/registry-lexicons@3655

@emdash-cms/registry-loader

npm i https://pkg.pr.new/@emdash-cms/registry-loader@3655

@emdash-cms/registry-moderation

npm i https://pkg.pr.new/@emdash-cms/registry-moderation@3655

@emdash-cms/registry-verification

npm i https://pkg.pr.new/@emdash-cms/registry-verification@3655

@emdash-cms/sandbox-workerd

npm i https://pkg.pr.new/@emdash-cms/sandbox-workerd@3655

@emdash-cms/x402

npm i https://pkg.pr.new/@emdash-cms/x402@3655

@emdash-cms/plugin-ai-moderation

npm i https://pkg.pr.new/@emdash-cms/plugin-ai-moderation@3655

@emdash-cms/plugin-atproto

npm i https://pkg.pr.new/@emdash-cms/plugin-atproto@3655

@emdash-cms/plugin-audit-log

npm i https://pkg.pr.new/@emdash-cms/plugin-audit-log@3655

@emdash-cms/plugin-color

npm i https://pkg.pr.new/@emdash-cms/plugin-color@3655

@emdash-cms/plugin-embeds

npm i https://pkg.pr.new/@emdash-cms/plugin-embeds@3655

@emdash-cms/plugin-field-kit

npm i https://pkg.pr.new/@emdash-cms/plugin-field-kit@3655

@emdash-cms/plugin-forms

npm i https://pkg.pr.new/@emdash-cms/plugin-forms@3655

@emdash-cms/plugin-webhook-notifier

npm i https://pkg.pr.new/@emdash-cms/plugin-webhook-notifier@3655

commit: 3a71680

@emdashbot emdashbot Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the right fix for the right problem. Danish and Georgian were already enabled admin locales (packages/admin/src/locales/locales.ts) and the date-fns preview loaders in GeneralSettings.tsx already included both, but getDayPickerLocale fell back to enUS because DAY_PICKER_LOCALES missed da and ka. Mapping those codes to react-day-picker’s locale objects is the minimal, idiomatic change.

I checked:

  • packages/admin/src/locales/day-picker.ts — new imports and map entries are consistent with the existing pattern.
  • packages/admin/src/components/ContentList.tsx and PublishingDateTimeEditor.tsx — both consume getDayPickerLocale(i18n.locale) with the exact locale codes from SUPPORTED_LOCALES, so the map entries will be hit.
  • packages/admin/src/locales/config.ts and locales.ts — the runtime locale list validates these codes and exposes them; SUPPORTED_LOCALES is the source the test pulls from.
  • packages/admin/tests/locales/day-picker.test.ts — the regression test enumerates every enabled non-English locale and asserts it does not fall back to enUS. It will fail if a locale is ever enabled without a matching day-picker mapping, which is exactly the regression this PR prevents.
  • The changeset at .changeset/danish-georgian-date-picker.md follows .changeset/README.md: present-tense lead, names the affected UI surfaces, identifies the affected users, and describes the observable fix.

No static issues. The change is limited to the reported bug, includes a meaningful guard test, and does not touch strings, routes, or queries.

@github-actions github-actions Bot added review/approved Approved; no new commits since and removed review/needs-review No maintainer or bot review yet labels Sep 29, 2026
@ascorbic

Copy link
Copy Markdown
Member

We should update the docs and agents.md for translators to tell them to add new languages to the picker, or generate the list automatically

@ascorbic
ascorbic merged commit aa2f87e into main Sep 30, 2026
61 of 63 checks passed
@ascorbic
ascorbic deleted the noah/angry-matsumoto-0330a5 branch September 30, 2026 10:25
@emdashbot emdashbot Bot mentioned this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants