diff --git a/data/languagefiles/zh.yaml b/data/languagefiles/zh.yaml index 7cd14c0d6..81ae8d799 100644 --- a/data/languagefiles/zh.yaml +++ b/data/languagefiles/zh.yaml @@ -53,6 +53,7 @@ week: - 星期 day: - 天 + - 日 hour: - 小时 minute: @@ -67,4 +68,6 @@ ago: simplifications: - 昨天: 1天 - 前天: 2天 + - (\d+)年(?:\s+)?(\d+)月(?:\s+)?(\d+)日(?:\s+)?(\d+):(\d+): \1-\2-\3 \4:\5 + - (\d+)年(?:\s+)?(\d+)月(?:\s+)?(\d+)日: \1-\2-\3 diff --git a/tests/test_date_parser.py b/tests/test_date_parser.py index 5a50bd011..257c2797f 100644 --- a/tests/test_date_parser.py +++ b/tests/test_date_parser.py @@ -328,6 +328,10 @@ def setUp(self): param('1 Mar 2015', datetime(2015, 3, 1, 0, 0)), param('1 Paz 2015', datetime(2015, 10, 1, 0, 0)), param('1 сер 2015', datetime(2015, 8, 1, 0, 0)), + # Chinese dates + param('2015年04月08日10:05', datetime(2015, 4, 8, 10, 5)), + param('2012年12月20日10:35', datetime(2012, 12, 20, 10, 35)), + param('2016年 2月 5日', datetime(2016, 2, 5, 0, 0)), ]) def test_dates_parsing(self, date_string, expected): self.given_utcnow(datetime(2012, 11, 13)) # Tuesday diff --git a/tests/test_languages.py b/tests/test_languages.py index 14ecc4564..5ac8a1173 100644 --- a/tests/test_languages.py +++ b/tests/test_languages.py @@ -24,6 +24,8 @@ def setUp(self): param('en', "friday, 03 september 2014", "friday 03 september 2014"), # Chinese param('zh', "1年11个月", "1 year 11 month"), + param('zh', "2015年04月08日10:05", "2015-04-08 10:05"), + param('zh', "2013年04月08日", "2013-04-08"), # French param('fr', "20 Février 2012", "20 february 2012"), param('fr', "Mercredi 19 Novembre 2013", "wednesday 19 november 2013"),