-
Notifications
You must be signed in to change notification settings - Fork 40
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
EDTF date validation fails on values containing unspecified digits and qualifiers #669
Comments
|
Response from LoC: Yes, that’s perfectly fine for EDTF. So you can have one or more X’s to indicate the level of imprecision, and then a ? to indicate you’re not even sure of that date expression as a whole. 198X? would mean “sometime in the 80’s, I think”. |
Thanks @joshdentremont. workbench_utils.py has a |
I'm going to set up a test suite to determine exactly which patterns aren't passing validation, so our temporary fix can scoped as small as possible and not duplicate what the library does. So far we have:
If anyone can verify other patterns, please drop them here. |
All of the following cause errors: These also cause errors, but I'm not sure they would ever come up in actual use, and they may not be valid EDTF |
I agree, they are unlikely to be used, but they are valid. These are just some of the oddities that EDTF allows. |
Do we have to validate that that date is not in the future, e.g. gist of validation against the patterns above is at https://gist.github.com/mjordan/3339b6d1c94ede805b1337184de07a8a if anyone wants to give it a run (provide the date string as an argument to the script, e.g, |
We do not have to validate that the date is current or past. Nothing in the spec indicates we can't specify future dates. |
I've pushed up the |
I think these "bad" values are technically acceptable: https://github.com/mjordan/islandora_workbench/blob/issue_669/tests/unit_tests.py#L358-L359 The year component doesn't need to be four digits. (Controlled Access Terms' EDTF validator was recently updated to remove this erroneous assumption: Islandora/controlled_access_terms@e7779e4) |
OK, thanks. What's the minimum number of years we should be validating for? |
I am mistaken, it does require four years. I went back to review the spec and was reminded that EDTF is an extension of ISO 8601, which means that the base rules of that spec still apply. Although EDTF only specifies a required number of year digits for significant digits notation, the base rules for ISO 8601 do require four digits. So, mea cupla, those three-digit years are invalid. |
Ah, good to know, thanks for checking. |
@mjordan Looks good. The values of YYYX? that were previously failing are no longer throwing errors. Thanks |
OK, thanks, I've merged the issue_669 branch with 3b1a448 so am closing this issue. |
The EDTF python module says that
198X?
is invalid, but it also produces that same format when parsing dates: ixc/python-edtf#38Drupal allows this type of date in an EDTF field, but there was discussion in Slack about whether it is valid EDTF.
I have reached out to LOC for clarification and will reply here when I hear back.
The text was updated successfully, but these errors were encountered: