filak / MTW-MeSH

Medical Subject Headings (MeSH) Translation Workflow
https://github.com/filak/MTW-MeSH/wiki
MIT License
6 stars 1 forks source link

Fix gen_date value #16

Closed filak closed 2 years ago

filak commented 2 years ago

https://github.com/filak/MTW-MeSH/blob/211dcfff5cdb3823a717178f5859830c6dc27cc2/flask-app/application/utils.py#L696

According to https://loc.gov/marc/bibliographic/bd005.html

filak commented 2 years ago

Replace:

 gen_date = timestamp[0:10].replace('-','')

Use arrow: https://arrow.readthedocs.io/en/latest/index.html#format

timestamp = '2022-01-22T11:55:29.481010+00:00'   # timestamp = data.get('timestamp')

tsa = arrow.get(timestamp)
gen_date = tsa.format('YYYYMMDDHHmmss.S')

# Expected value: 
# 20220122115529.4
filak commented 2 years ago

Fixed with https://github.com/filak/MTW-MeSH/commit/a3866acef7655e721d72af00d8e673061ba912cc