mirror of
https://github.com/pretix/pretix.git
synced 2026-05-08 15:44:02 +00:00
Add compat function for date.fromisocalendar for Python 3.6-3.7
This commit is contained in:
9
src/pretix/helpers/compat.py
Normal file
9
src/pretix/helpers/compat.py
Normal file
@@ -0,0 +1,9 @@
|
||||
import datetime
|
||||
import sys
|
||||
|
||||
|
||||
def date_fromisocalendar(isoyear, isoweek, isoday):
|
||||
if sys.version_info < (3, 8):
|
||||
return datetime.datetime.strptime(f'{isoyear}-W{isoweek}-{isoday}', "%G-W%V-%u")
|
||||
else:
|
||||
return datetime.datetime.fromisocalendar(isoyear, isoweek, isoday)
|
||||
Reference in New Issue
Block a user