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.
This commit is contained in:
Florian Maurer 2023-09-11 07:17:53 +02:00 committed by GitHub
parent f0afecedbf
commit 5a8383ed30
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -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)