-
Notifications
You must be signed in to change notification settings - Fork 95
Fix some time issues #854
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
base: develop
Are you sure you want to change the base?
Fix some time issues #854
Conversation
…e to remind myself.
… in the "textVersion" when we do the next official release.
R/construct_api_requests.R
Outdated
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.
Does this need to be changed to date?
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.
Actually, I think it should be changed to logical (because it tells the code whether or not to return a date or dateTime)
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.
Oh, I meant the input is named "date" and it is logical, right?
|
|
||
| if(length(datetime) == 1){ | ||
| # If the user has "P" or the "/" we assume they know what they are doing | ||
| if(grepl("P", datetime, ignore.case = TRUE) | |
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.
FYI, I tried this with a lowercase "p7d" and "p7D" and the API will not have it. I don't think there's necessarily anything you need to do here, just a random test.
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.
we can plop a toupper in there, good to know!
ehinman
left a comment
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.
This looks good. Approved. I particularly love this implementation:
start_end <- as.POSIXct(c("2021-01-01 12:15:00",
"2022-01-01 16:45"),
tz = "America/New_York")
dataRetrieval::format_api_dates(start_end)
Very nice.
A couple thoughts/suggestions that are optional: The function documentation for time, begin, and end don't go into detail on the range of dates that the functions will accept. Is this intentional?
In the Water Data APIs vignette, it does a few things with the time input, and there's a section that covers the time zone reference table, but it might be nice to show off using UTC offsets in an example, or the really lovely time zone example I highlight above, where you don't have to futz with offsets at all.
Should now allow this:
(which fixes #853 )
and this:
(which fixes #839 )