From 11ad3a76e532a042f4f6b4a167948bd2c42bfb38 Mon Sep 17 00:00:00 2001 From: greymoth <246701683+greymoth-jp@users.noreply.github.com> Date: Tue, 30 Jun 2026 13:42:07 +0900 Subject: [PATCH] fix(locale): use Japanese date formats for the ja locale --- src/pendulum/locales/ja/custom.py | 12 ++++++------ tests/formatting/test_formatter.py | 7 +++++++ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/src/pendulum/locales/ja/custom.py b/src/pendulum/locales/ja/custom.py index 4cb5b956..ffeb8cbb 100644 --- a/src/pendulum/locales/ja/custom.py +++ b/src/pendulum/locales/ja/custom.py @@ -13,11 +13,11 @@ "before": "{0} 前", # Date formats "date_formats": { - "LTS": "h:mm:ss A", - "LT": "h:mm A", - "L": "MM/DD/YYYY", - "LL": "MMMM D, YYYY", - "LLL": "MMMM D, YYYY h:mm A", - "LLLL": "dddd, MMMM D, YYYY h:mm A", + "LTS": "HH:mm:ss", + "LT": "HH:mm", + "L": "YYYY/MM/DD", + "LL": "YYYY年M月D日", + "LLL": "YYYY年M月D日 HH:mm", + "LLLL": "YYYY年M月D日 dddd HH:mm", }, } diff --git a/tests/formatting/test_formatter.py b/tests/formatting/test_formatter.py index 4c4b0088..b83b67be 100644 --- a/tests/formatting/test_formatter.py +++ b/tests/formatting/test_formatter.py @@ -250,6 +250,13 @@ def test_date_formats(): assert f.format(d, "LLL", locale="fr") == "28 août 2016 07:03" assert f.format(d, "LLLL", locale="fr") == "dimanche 28 août 2016 07:03" + assert f.format(d, "LT", locale="ja") == "07:03" + assert f.format(d, "LTS", locale="ja") == "07:03:06" + assert f.format(d, "L", locale="ja") == "2016/08/28" + assert f.format(d, "LL", locale="ja") == "2016年8月28日" + assert f.format(d, "LLL", locale="ja") == "2016年8月28日 07:03" + assert f.format(d, "LLLL", locale="ja") == "2016年8月28日 日曜日 07:03" + def test_escape(): f = Formatter()