Try harder to guess date format and update template #7901
Merged
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.
While desirable, it is just not possible to expect random people to pay attention to ISO format specifications, so they give
dd/mm/yyyywhile we expectyyyy-mm-dd. This PR tries a bit harder in gmtio_examine_current_record to determine what we have and update the template if needed. If the user have set FORMAT_DATE_IN then we do not change it, but if it is set to the default ISO template (yyyy-mm-dd) then we check if a candidate absolute date-time input can work with that or if we got something else, e.g.,dd/mm/yyyyordd-monthname-yyyyand need to rebuild the active FORMAT_DATE_IN format.@joa-quim, have a look at the gmtio_check_abstime_format_is_suitable function in gmt_io.c. It should catch most common things but not idiocy like OCT-2001-11, but we could add even that...