mirror of
https://github.com/bookwyrm-social/bookwyrm.git
synced 2024-12-23 16:40:36 +00:00
Handle parsed dates that already have a timezone on import.
Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
This commit is contained in:
parent
12541d5f1c
commit
b564e514fd
1 changed files with 6 additions and 3 deletions
|
@ -175,9 +175,12 @@ class ImportItem(models.Model):
|
||||||
def date_added(self):
|
def date_added(self):
|
||||||
"""when the book was added to this dataset"""
|
"""when the book was added to this dataset"""
|
||||||
if self.normalized_data.get("date_added"):
|
if self.normalized_data.get("date_added"):
|
||||||
return timezone.make_aware(
|
parsed_date_added = dateutil.parser.parse(self.normalized_data.get("date_added"))
|
||||||
dateutil.parser.parse(self.normalized_data.get("date_added"))
|
if timezone.is_aware(parsed_date_added):
|
||||||
)
|
# Keep timezone if import already had one
|
||||||
|
return parsed_date_added
|
||||||
|
|
||||||
|
return timezone.make_aware(parsed_date_added)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
|
|
Loading…
Reference in a new issue