mirror of
https://github.com/pretix/pretix.git
synced 2026-08-17 11:56:27 +00:00
Stop using ordinal numbers in English date represenation (Z#23210534)
This commit is contained in:
@@ -76,11 +76,11 @@ def daterange(df, dt, as_html=False):
|
||||
return format_html(base_format, _date(df, "j F"), until, _date(dt, "j F Y"))
|
||||
elif lng.startswith("en"):
|
||||
if df.year == dt.year and df.month == dt.month and df.day == dt.day:
|
||||
return format_html(base_format, _date(df, "D, N jS, Y"))
|
||||
return format_html(base_format, _date(df, "D, N j, Y"))
|
||||
elif df.year == dt.year and df.month == dt.month:
|
||||
return format_html(base_format, _date(df, "N jS"), until, _date(dt, "jS, Y"))
|
||||
return format_html(base_format, _date(df, "N j"), until, _date(dt, "j, Y"))
|
||||
elif df.year == dt.year:
|
||||
return format_html(base_format, _date(df, "N jS"), until, _date(dt, "N jS, Y"))
|
||||
return format_html(base_format, _date(df, "N j"), until, _date(dt, "N j, Y"))
|
||||
elif lng.startswith("es"):
|
||||
if df.year == dt.year and df.month == dt.month and df.day == dt.day:
|
||||
return format_html(base_format, _date(df, "DATE_FORMAT"))
|
||||
|
||||
@@ -38,5 +38,5 @@ SHORT_DATE_FORMAT = 'Y-m-d'
|
||||
SHORT_DATETIME_FORMAT = 'Y-m-d H:i'
|
||||
TIME_FORMAT = 'H:i'
|
||||
WEEK_FORMAT = '\\W W, o'
|
||||
WEEK_DAY_FORMAT = 'D, M jS'
|
||||
WEEK_DAY_FORMAT = 'D, M j'
|
||||
SHORT_MONTH_DAY_FORMAT = 'd.m.'
|
||||
|
||||
@@ -38,7 +38,7 @@ SHORT_DATE_FORMAT = "Y-m-d"
|
||||
SHORT_DATETIME_FORMAT = 'Y-m-d P'
|
||||
TIME_FORMAT = 'P'
|
||||
WEEK_FORMAT = '\\W W, o'
|
||||
WEEK_DAY_FORMAT = 'D, M jS'
|
||||
WEEK_DAY_FORMAT = 'D, M j'
|
||||
SHORT_MONTH_DAY_FORMAT = 'm/d'
|
||||
|
||||
DATE_INPUT_FORMATS = [
|
||||
|
||||
@@ -25,7 +25,7 @@ SHORT_DATE_FORMAT = 'm/d/Y'
|
||||
SHORT_DATETIME_FORMAT = 'm/d/Y P'
|
||||
TIME_FORMAT = 'P'
|
||||
WEEK_FORMAT = '\\W W, o'
|
||||
WEEK_DAY_FORMAT = 'D, M jS'
|
||||
WEEK_DAY_FORMAT = 'D, M j'
|
||||
SHORT_MONTH_DAY_FORMAT = 'm/d'
|
||||
|
||||
DATE_INPUT_FORMATS = [
|
||||
|
||||
@@ -50,8 +50,8 @@ def test_same_day_german():
|
||||
def test_same_day_english():
|
||||
with translation.override('en'):
|
||||
df = date(2003, 2, 1)
|
||||
assert daterange(df, df) == "Sat, Feb. 1st, 2003"
|
||||
assert daterange(df, df, as_html=True) == '<time datetime="2003-02-01">Sat, Feb. 1st, 2003</time>'
|
||||
assert daterange(df, df) == "Sat, Feb. 1, 2003"
|
||||
assert daterange(df, df, as_html=True) == '<time datetime="2003-02-01">Sat, Feb. 1, 2003</time>'
|
||||
|
||||
|
||||
def test_same_day_spanish():
|
||||
@@ -82,10 +82,10 @@ def test_same_month_english():
|
||||
with translation.override('en'):
|
||||
df = date(2003, 2, 1)
|
||||
dt = date(2003, 2, 3)
|
||||
assert daterange(df, dt) == "Feb. 1st – 3rd, 2003"
|
||||
assert daterange(df, dt, as_html=True) == '<time datetime="2003-02-01">Feb. 1st</time> ' \
|
||||
assert daterange(df, dt) == "Feb. 1 – 3, 2003"
|
||||
assert daterange(df, dt, as_html=True) == '<time datetime="2003-02-01">Feb. 1</time> ' \
|
||||
'<span aria-hidden="true">–</span><span class="sr-only"> until </span> ' \
|
||||
'<time datetime="2003-02-03">3rd, 2003</time>'
|
||||
'<time datetime="2003-02-03">3, 2003</time>'
|
||||
|
||||
|
||||
def test_same_month_spanish():
|
||||
@@ -112,10 +112,10 @@ def test_same_year_english():
|
||||
with translation.override('en'):
|
||||
df = date(2003, 2, 1)
|
||||
dt = date(2003, 4, 3)
|
||||
assert daterange(df, dt) == "Feb. 1st – April 3rd, 2003"
|
||||
assert daterange(df, dt, as_html=True) == '<time datetime="2003-02-01">Feb. 1st</time> ' \
|
||||
assert daterange(df, dt) == "Feb. 1 – April 3, 2003"
|
||||
assert daterange(df, dt, as_html=True) == '<time datetime="2003-02-01">Feb. 1</time> ' \
|
||||
'<span aria-hidden="true">–</span><span class="sr-only"> until </span> ' \
|
||||
'<time datetime="2003-04-03">April 3rd, 2003</time>'
|
||||
'<time datetime="2003-04-03">April 3, 2003</time>'
|
||||
|
||||
|
||||
def test_same_year_spanish():
|
||||
|
||||
Reference in New Issue
Block a user