-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Add docstring for Dates.adjust #52914
Conversation
You also need to update the docstring test for the Dates module, similar to #52913 (comment) |
Regardless of whether it should be exported/public or not, it doesn't hurt to have a docstring. |
stdlib/Dates/src/adjusters.jl
Outdated
@@ -204,6 +226,27 @@ function adjust(df::DateFunction, start, step, limit) | |||
throw(ArgumentError("Adjustment limit reached: $limit iterations")) | |||
end | |||
|
|||
""" | |||
adjust(df::DateFunction, start) -> TimeType |
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.
Better to have a single docstring, i.e. merge these two.
We may not want to document the DateFunction
method, actually, since DateFunction
is not public.
Co-authored-by: Steven G. Johnson <stevenj@mit.edu>
stdlib/Dates/src/adjusters.jl
Outdated
|
||
""" | ||
adjust(df::DateFunction, start, step, limit) -> TimeType | ||
|
||
Adjusts the date in `start` until `f::Function` in `df::DateFunction` returns `true`. | ||
The step size dictates change in `start` on every iteration. If `limit` iterations occur, | ||
then an [`ArgumentError`](@ref) is thrown. | ||
|
||
# Examples | ||
```jldoctest | ||
julia> adjust(date -> month(date) == 10, Date(2022, 1, 1), step=Month(3), limit=10) | ||
2022-10-01 | ||
|
||
julia> adjust(date -> year(date) == 2025, Date(2022, 1, 1), step=Year(1), limit=4) | ||
2025-01-01 | ||
|
||
julia> adjust(date -> day(date) == 15, Date(2022, 1, 1); step=Year(1), limit=3) | ||
ERROR: ArgumentError: Adjustment limit reached: 3 iterations | ||
Stacktrace: | ||
[...] | ||
``` | ||
""" |
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.
""" | |
adjust(df::DateFunction, start, step, limit) -> TimeType | |
Adjusts the date in `start` until `f::Function` in `df::DateFunction` returns `true`. | |
The step size dictates change in `start` on every iteration. If `limit` iterations occur, | |
then an [`ArgumentError`](@ref) is thrown. | |
# Examples | |
```jldoctest | |
julia> adjust(date -> month(date) == 10, Date(2022, 1, 1), step=Month(3), limit=10) | |
2022-10-01 | |
julia> adjust(date -> year(date) == 2025, Date(2022, 1, 1), step=Year(1), limit=4) | |
2025-01-01 | |
julia> adjust(date -> day(date) == 15, Date(2022, 1, 1); step=Year(1), limit=3) | |
ERROR: ArgumentError: Adjustment limit reached: 3 iterations | |
Stacktrace: | |
[...] | |
``` | |
""" |
Only document the Function
interface below, since DateFunction
is private.
It appears that either this or #53027 needs to be reverted, due to a merge conflict between them that is breaking CI. Which is better to revert and reland? |
The CI on master after they both merged looks green-ish to me: |
|
Thanks! I'm so used to red that I instinctively ignored the fact that a single check failed. |
This is a PR for the issue #52725.
Thanks!