Skip to content
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 to docstrings HourEnding and HourBegining have default inclusivity #77

Closed
oxinabox opened this issue Oct 14, 2019 · 3 comments · Fixed by #138
Closed

Add to docstrings HourEnding and HourBegining have default inclusivity #77

oxinabox opened this issue Oct 14, 2019 · 3 comments · Fixed by #138
Labels
good first issue Good for newcomers

Comments

@oxinabox
Copy link
Member

To me it seems like a natural assumption that
HourEnding would have inclusivity of false, true,
and HourBeginning would have inclusivity of true, false

but I am not sure if I am typical or not.

@nickrobinson251
Copy link
Contributor

Makes sense to me. And isn't it already the case?

julia> using Intervals, Dates

julia> HourEnding(DateTime(2017, 02, 28, 06))
AnchoredInterval{-1 hour,DateTime}(2017-02-28T06:00:00, Inclusivity(false, true))

julia> HourBeginning(DateTime(2017, 02, 28, 06))
AnchoredInterval{1 hour,DateTime}(2017-02-28T06:00:00, Inclusivity(true, false))

(tmp.BCUQL3co) pkg> status Intervals
    Status `/private/var/folders/hx/1h0bbkfd18d4n1qrnwmrl4j00000gn/T/tmp.BCUQL3co/Project.toml`
  [d8418881] Intervals v0.5.1

@oxinabox
Copy link
Member Author

we should add it to the docstrings....

@nickrobinson251
Copy link
Contributor

yes, could be said in words

it is there in the examples

julia> HourEnding(DateTime(2016, 8, 11, 2, 30))
HourEnding{DateTime}(2016-08-11T02:30:00, Inclusivity(false, true))
```
The `HE` and `HB` pseudoconstructors round the input up or down to the nearest hour, as
appropriate:
```julia
julia> HE(DateTime(2016, 8, 11, 2, 30))
HourEnding{DateTime}(2016-08-11T03:00:00, Inclusivity(false, true))
julia> HB(DateTime(2016, 8, 11, 2, 30))
HourBeginning{DateTime}(2016-08-11T02:00:00, Inclusivity(true, false))
```
### Example
```julia
julia> AnchoredInterval{Hour(-1)}(DateTime(2016, 8, 11, 12))
HourEnding{DateTime}(2016-08-11T12:00:00, Inclusivity(false, true))
julia> AnchoredInterval{Day(1)}(DateTime(2016, 8, 11))
AnchoredInterval{1 day, DateTime}(2016-08-11T00:00:00, Inclusivity(true, false))
julia> AnchoredInterval{Minute(5)}(DateTime(2016, 8, 11, 12, 30), true, true)
AnchoredInterval{5 minutes, DateTime}(2016-08-11T12:30:00, Inclusivity(true, true))

@nickrobinson251 nickrobinson251 changed the title Should HourEnding and HourBegining default inclusivity? Add to docstrings HourEnding and HourBegining have default inclusivity Jan 27, 2020
@nickrobinson251 nickrobinson251 added the good first issue Good for newcomers label Jan 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants