mirror of
https://github.com/pretix/pretix.git
synced 2026-05-07 15:34:02 +00:00
Fixed bugs and added test for date range rendering (#488)
* fixed bug for same dates, added unit check for daterange * fixed local language override in unit test
This commit is contained in:
@@ -6,12 +6,16 @@ def daterange(df, dt):
|
||||
lng = get_language()
|
||||
|
||||
if lng.startswith("de"):
|
||||
if df.year == dt.year and df.month == dt.month:
|
||||
if df.year == dt.year and df.month == dt.month and df.day == dt.day:
|
||||
return "{}".format(_date(df, "j. F Y"))
|
||||
elif df.year == dt.year and df.month == dt.month:
|
||||
return "{}.–{}".format(_date(df, "j"), _date(dt, "j. F Y"))
|
||||
elif df.year == dt.year:
|
||||
return "{} – {}".format(_date(df, "j. F"), _date(dt, "j. F Y"))
|
||||
elif lng.startswith("en"):
|
||||
if df.year == dt.year and df.month == dt.month:
|
||||
if df.year == dt.year and df.month == dt.month and df.day == dt.day:
|
||||
return "{}".format(_date(df, "N jS, Y"))
|
||||
elif df.year == dt.year and df.month == dt.month:
|
||||
return "{} – {}".format(_date(df, "N jS"), _date(dt, "jS, Y"))
|
||||
elif df.year == dt.year:
|
||||
return "{} – {}".format(_date(df, "N jS"), _date(dt, "N jS, Y"))
|
||||
|
||||
Reference in New Issue
Block a user