From 9275baabd2ae32d7fe75379e10c833c7e7931117 Mon Sep 17 00:00:00 2001 From: Arpit <9051659+arpitgogia@users.noreply.github.com> Date: Sat, 6 Jun 2020 22:58:43 +0530 Subject: [PATCH] Use system timezone for bookmark's "Added date" --- bookmarks/services/importer.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bookmarks/services/importer.py b/bookmarks/services/importer.py index 91aaccc..fbfdec1 100644 --- a/bookmarks/services/importer.py +++ b/bookmarks/services/importer.py @@ -28,7 +28,8 @@ def _import_bookmark_tag(bookmark_tag: bs4.Tag, user: User): bookmark = _get_or_create_bookmark(url, user) bookmark.url = url - bookmark.date_added = datetime.utcfromtimestamp(int(link_tag['add_date'])) + add_date = link_tag.get('add_date', datetime.now().timestamp()) + bookmark.date_added = datetime.utcfromtimestamp(int(add_date)).astimezone() bookmark.date_modified = bookmark.date_added bookmark.unread = link_tag.get('toread', '0') == '1' bookmark.title = link_tag.string