Repository navigation
A date that names its weekday is read, so "Tuesday, March 17, 2020" becomes 2020-03-17 instead of no value - #1439
Open
rudycelekli wants to merge 1 commit into
Open
rudycelekli wants to merge 1 commit into
rudycelekli wants to merge 1 commit into
Conversation
…ecomes 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 a month-name date only when it is exactly two or three words: month, day and year in either order, or month and year. Press releases, letters, court filings and email headers usually put the weekday first: "Tuesday, March 17, 2020", "Tue, 17 Mar 2020". That is four words, so the date is not read, although the weekday only restates the day. The same text without the weekday works.So a date attribute or interval endpoint quoted with its weekday is dropped, and
literal_objectlets it through as a thing instead of a value.What changes
If the first word is a weekday name (chrono's
Weekdayparser: full name or three-letter abbreviation, any case), it is set aside and the rest is read as before. The weekday then has to agree with the date it introduces: "Monday, March 17, 2020" (a Tuesday) is a contradiction and stays unread, as does a weekday in front of a month-only date ("Tuesday, March 2020").How it was checked
a_date_that_names_its_weekday_is_read, covers "Tuesday, March 17, 2020", "Tue, 17 Mar 2020", "tuesday March 17th 2020",read_time("Monday, September 30, 2024"), a weekday that does not match, and a weekday before a month.Tuesday, March 17, 2020 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