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:
parent
f0afecedbf
commit
5a8383ed30
|
@ -27,7 +27,7 @@ with open(yanic_db_path, encoding='UTF-8') as handle:
|
||||||
|
|
||||||
total = 0
|
total = 0
|
||||||
updated = 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
|
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
|
v2_date_format = '%Y-%m-%dT%H:%M:%S.%fZ' # 2015-08-22T16:05:02.000Z
|
||||||
version = legacy_db['version']
|
version = legacy_db['version']
|
||||||
|
@ -39,7 +39,7 @@ if version == 1:
|
||||||
legacy_date_format = v1_date_format # ffmap-backend
|
legacy_date_format = v1_date_format # ffmap-backend
|
||||||
elif version == 2:
|
elif version == 2:
|
||||||
legacy_date_format = v2_date_format # hopglass
|
legacy_date_format = v2_date_format # hopglass
|
||||||
fallback_date_format = v1_date_format # ffmap-backend
|
fallback_date_format = yanic_date_format # other yanic
|
||||||
else:
|
else:
|
||||||
print('unhandled nodes.json version number!', file=sys.stderr)
|
print('unhandled nodes.json version number!', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
Loading…
Reference in New Issue