Prevent uploading low precision timestamp when high precision one exists #28
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Our upload framework will upload a date with the value YYYY even if the item already has a more precise value, like YYYY-MM-DD.
Technically this is correct behavior because a claim can have multiple values. Normally, multiple values are not uploaded if they are identified as duplicates, however in this case it is not applicable because obviously those are two different values.
Thus we need an extra check specifically for datetime values to detect whether the new value is a less precise version of the old value, in which case it should be treated as a duplicate and not uploaded.
Note that if the two values are actually different, like 1988-02-02 and 1989, they should not be treated as duplicates, as they are not different versions of the same datetime.
This is very relevant to the authority upload, as Libris contains mostly only years of authors' birth/death dates.
Task: https://phabricator.wikimedia.org/T202400