forked from CGM_Public/pretix_original
Import: Parse iso dates
This commit is contained in:
@@ -213,7 +213,13 @@ class DatetimeColumnMixin:
|
||||
except (ValueError, TypeError):
|
||||
pass
|
||||
else:
|
||||
raise ValidationError(_("Could not parse {value} as a date and time.").format(value=value))
|
||||
try:
|
||||
d = datetime.datetime.fromisoformat(value)
|
||||
if not d.tzinfo:
|
||||
d = d.replace(tzinfo=self.timezone)
|
||||
return d
|
||||
except (ValueError, TypeError):
|
||||
raise ValidationError(_("Could not parse {value} as a date and time.").format(value=value))
|
||||
|
||||
|
||||
class DecimalColumnMixin:
|
||||
|
||||
@@ -66,7 +66,7 @@ def inputfile_factory(multiplier=1):
|
||||
'A': 'GHIJK432',
|
||||
'B': 'Ticket',
|
||||
'C': 'False',
|
||||
'D': '2021-05-28 11:00:00',
|
||||
'D': '2021-05-28T11:00:00+00:00',
|
||||
'E': '2',
|
||||
'F': '1',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user