Giter Site home page Giter Site logo

Comments (3)

oxinabox avatar oxinabox commented on June 4, 2024 1

we should add it to the docstrings....

from intervals.jl.

nickrobinson251 avatar nickrobinson251 commented on June 4, 2024

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

from intervals.jl.

nickrobinson251 avatar nickrobinson251 commented on June 4, 2024

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))

from intervals.jl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.