Skip to content

fix(locale): use Japanese date formats for the ja locale#977

Merged
Secrus merged 1 commit into
python-pendulum:masterfrom
greymoth-jp:fix/ja-date-formats
Jun 30, 2026
Merged

fix(locale): use Japanese date formats for the ja locale#977
Secrus merged 1 commit into
python-pendulum:masterfrom
greymoth-jp:fix/ja-date-formats

Conversation

@greymoth-jp

Copy link
Copy Markdown
Contributor

The ja locale's date_formats were left with the English/US defaults, so localized format tokens render Japanese dates in English order with US separators:

dt = pendulum.datetime(2026, 6, 30, 13, 5)
dt.format("L",    locale="ja")  # "06/30/2026"
dt.format("LL",   locale="ja")  # "6月 30, 2026"  (a Japanese month token in English "month day, year" order)
dt.format("LLLL", locale="ja")  # "火曜日, 6月 30, 2026 1:05 午後"

Every other CJK locale already localizes these. zh uses YYYY年MMMD日 / Ah点mm分 and ko uses YYYY년 MMMM D일 / A h시 m분, so ja is the one left on the defaults. The values here match the standard Japanese formats used by Moment.js and Day.js (locale/ja):

LT    HH:mm
LTS   HH:mm:ss
L     YYYY/MM/DD
LL    YYYY年M月D日
LLL   YYYY年M月D日 HH:mm
LLLL  YYYY年M月D日 dddd HH:mm

After the change:

dt.format("L",    locale="ja")  # "2026/06/30"
dt.format("LL",   locale="ja")  # "2026年6月30日"
dt.format("LLLL", locale="ja")  # "2026年6月30日 火曜日 13:05"

Only the format strings change; the day and month names still come from the existing ja CLDR data. I added a ja block to test_date_formats next to the existing fr assertions. It fails on the old formats and passes on the new ones, and zh/ko output is unchanged.

@codspeed-hq

codspeed-hq Bot commented Jun 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 1 untouched benchmark


Comparing greymoth-jp:fix/ja-date-formats (11ad3a7) with master (1d9e31a)

Open in CodSpeed

@Secrus Secrus merged commit cbab60c into python-pendulum:master Jun 30, 2026
18 checks passed
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.

2 participants