From 5a8383ed30e0a91cae2bc94e4e4083a60bf7ce19 Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Mon, 11 Sep 2023 07:17:53 +0200 Subject: [PATCH] feat(yanic-import-timestamp): allow importing from other yanic instance (#223) This fixes an issue when an import from other yanic is needed. The datetime can have different timezones with yanic_date_format. The latest yanic format is now used as a fallback if the millisecond format from hopglass is not present. --- contrib/yanic-import-timestamp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contrib/yanic-import-timestamp b/contrib/yanic-import-timestamp index 16c53b5..159ce57 100755 --- a/contrib/yanic-import-timestamp +++ b/contrib/yanic-import-timestamp @@ -27,7 +27,7 @@ with open(yanic_db_path, encoding='UTF-8') as handle: total = 0 updated = 0 -yanic_date_format = '%Y-%m-%dT%H:%M:%S+0000' +yanic_date_format = '%Y-%m-%dT%H:%M:%S%z' v1_date_format = '%Y-%m-%dT%H:%M:%S.%f' # 2017-05-31T18:30:19.759610 v2_date_format = '%Y-%m-%dT%H:%M:%S.%fZ' # 2015-08-22T16:05:02.000Z version = legacy_db['version'] @@ -39,7 +39,7 @@ if version == 1: legacy_date_format = v1_date_format # ffmap-backend elif version == 2: legacy_date_format = v2_date_format # hopglass - fallback_date_format = v1_date_format # ffmap-backend + fallback_date_format = yanic_date_format # other yanic else: print('unhandled nodes.json version number!', file=sys.stderr) sys.exit(1)