File tree 2 files changed +8
-7
lines changed
2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -228,6 +228,14 @@ def babel_format_date(
228
228
if not hasattr (date , 'tzinfo' ):
229
229
formatter = babel .dates .format_date
230
230
231
+ if not locale :
232
+ # Babel would not accept a falsy locale
233
+ # (or would try to fall back to the LC_TIME
234
+ # locale, which would be not what was requested),
235
+ # so we can just short-cut to English, as we
236
+ # would for the `"fallback to English"` case.
237
+ locale = 'en'
238
+
231
239
try :
232
240
return formatter (date , format , locale = locale )
233
241
except (ValueError , babel .core .UnknownLocaleError ):
Original file line number Diff line number Diff line change 4
4
5
5
import datetime
6
6
import os
7
- import sys
8
7
import time
9
8
from pathlib import Path
10
9
from typing import TYPE_CHECKING
11
10
12
- import babel
13
11
import pytest
14
12
from babel .messages .mofile import read_mo
15
13
@@ -60,11 +58,6 @@ def test_catalog_write_mo(tmp_path):
60
58
assert read_mo (f ) is not None
61
59
62
60
63
- # https://github.com/python-babel/babel/issues/1183
64
- @pytest .mark .xfail (
65
- sys .platform == 'win32' and babel .__version__ == '2.17.0' ,
66
- reason = 'Windows tests fail with Babel 2.17' ,
67
- )
68
61
def test_format_date ():
69
62
date = datetime .date (2016 , 2 , 7 )
70
63
You can’t perform that action at this time.
0 commit comments