Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upserting doi can change the precision of date-released #9

Closed
jspaaks opened this issue Jun 30, 2021 · 1 comment
Closed

upserting doi can change the precision of date-released #9

jspaaks opened this issue Jun 30, 2021 · 1 comment

Comments

@jspaaks
Copy link
Member

jspaaks commented Jun 30, 2021

e.g. this happened during release of zenodraft==0.9.0 on Zenodo https://zenodo.org/record/5046393

The CITATION.cff had

https://github.com/zenodraft/zenodraft/blob/fa34647049e31fe6ebca4312d35fde61843afd41/CITATION.cff#L11

but during upserting of the doi those data are parsed, expanded, and written again. However it looks like the date-released value is written as a datetime object.

@jspaaks jspaaks transferred this issue from zenodraft/zenodraft Jun 30, 2021
@jspaaks
Copy link
Member Author

jspaaks commented Jun 30, 2021

bit of an ugly hack but it seems to work:

action/src/upserting.ts

Lines 148 to 159 in 5644867

// replace full precision dates with just YYYY-MM-DD before writing to file
const regexes = [
new RegExp('(?<k>date-accessed): (?<v>[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'),
new RegExp('(?<k>date-downloaded): (?<v>[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'),
new RegExp('(?<k>date-published): (?<v>[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'),
new RegExp('(?<k>date-released): (?<v>[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'),
new RegExp('(?<k>date-end): (?<v>[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g'),
new RegExp('(?<k>date-start): (?<v>[0-9]{4}-[0-9]{2}-[0-9]{2})T00:00:00.000Z', 'g')
]
for (const regex of regexes) {
cffstr = cffstr.replace(regex, '$<k>: $<v>')
}

@jspaaks jspaaks closed this as completed Jun 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant