-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix parse_with() #33
Fix parse_with() #33
Conversation
ymd_z() for parse_with still needs to be fixed - tests with it are failing and those are currently commented out. Ignore deprecation warnings for now - come back to that after finishing resolving issue ymd_z (as separate pull request).
Hey @kdwarn, thanks for the PR! I will have a look when I get home. |
To be clear, |
Ok, clippy shouldn’t complain anymore. If you want, I can squash this all into one commit. |
@kdwarn Thanks for fixing the linter warnings. I will squash the commits when merging the PR. I had a look at your PR. Looks good to me. I'm working on fixing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Excellent! |
I have been using the
dateparser
library in developing a project of mine (https://codeberg.org/kdwarn/ts-cli) and found a bug with theparse_with
function. As detailed in an issue there (https://codeberg.org/kdwarn/ts-cli/issues/18), it wasn't converting correctly to UTC. Essentially, thedefault_time
parameter toParse::new
needs to be different if usingparse
andparse_with_timezone
or if usingparse_with
. The solution I came up with was to changeParse
struct's fielddefault_time
to anOption<NaiveTime>
rather than aNaiveTime
, and then in the various functions either use the provideddefault_time
if given or create one at that time. Given this, I imagine you'll want to do a version bump.In the existing code, there were only doctests that covered
parse_with
(no separate unit tests), and at least one was failing. I wrote out what I think to be a fairly comprehensive set of units tests, and both they and the doctests are now passing. I had to modify a lot of tests to account for changingdefault_time
fromNaiveTime
toOption<NativeTime>
.Note that I also bumped to the new 2021 edition of Rust, and there seems to be no issues with that.
Also, I explicitly bumped to 0.4.24 of
chrono
, and then turned off deprecation warnings, as there are many. I figure they can be addressed separately after this.