Repository navigation
A date written with hyphens and a month name is read, so "17-Mar-2020" becomes 2020-03-17 instead of no value - #1438
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
…" becomes 2020-03-17 instead of no value Signed-off-by: Rudy Celekli <rudy@gradiahq.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Why
written_datereads dates whose month is a name ("17 March 2020", "Mar. 17, 2020"). It splits the text into words on whitespace, commas and periods only. "17-Mar-2020" is the default date display in Excel'sd-mmm-yyyyformat and in Oracle exports, so it is how dates arrive from spreadsheet tables, ledgers and many filings rendered from them. Because a hyphen does not separate words, the whole thing is one word, and the date is not read. The month is a name, so the day and month order is not in doubt.So a date attribute or interval endpoint written "17-Mar-2020" is dropped, and
literal_objecttreats it as a thing instead of a value, while "17 Mar 2020" works.What changes
The month-name reader also splits on
-. The existing guards decide the rest: all-number forms ("04-03-2020") are still ambiguous and unread, a two-digit year ("17-Mar-20") is still not guessed, "mid-March 2020" is still not a date, and ISO "2020-03-17" still goes toparse_timeand is kept as written.How it was checked
a_date_with_hyphens_and_a_month_name_is_read, covers "17-Mar-2020", "17-MAR-2020", "1-January-2021", "Mar-2020",read_time("30-Sep-2025"), and the four cases above.left: None right: Some(String("2020-03-17")).cargo test -p utopia-extract --lib: 113 passed.cargo fmt -p utopia-extract --checkandcargo clippy -p utopia-extract --all-targets -- -D warningspass.Before review
git commit -s)cargo fmt --all --check,cargo clippyandcargo testpass for the touched crate