PeriodicalDates.jl icon indicating copy to clipboard operation
PeriodicalDates.jl copied to clipboard

Build status

PeriodicalDates.jl

This packages makes it easier to work with monthly, quarterly, or yearly dates. It defines three types:

  • A MonthlyDate <: TimeType type

    ulia> using Dates, PeriodicalDates
    ulia> dt = MonthlyDate(1990, 1)
     Alternatively, construct from a date
    ulia> dtm = MonthlyDate(Date(1990, 1))
     Alternatively, contruct from a string with default dateformat"yyyy-mm"
    ulia> dtm = MonthlyDate("1990-01")
     or any other DateFormat
    ulia> dtm = MonthlyDate("1990/01", "yyyy/mm")
     Arithmetic works as expected
    ulia> dtm + Month(1)
    ulia> Date(dtm)
     1990-01-01
    
    
  • A QuarterlyDate <: TimeType type

    ulia> using Dates, PeriodicalDates
    ulia> dtq = QuarterlyDate(1990, 1)
     Alternatively, construct from a date
    ulia> dtq = QuarterlyDate(Date(1990, 1))
     Alternatively, contruct from a string with default dateformat"yyyy-Qq"
    ulia> dtq = QuarterlyDate("1990-Q1") 
     or any other DateFormat
    ulia> dtq = QuarterlyDate("1990/04", "yyyy/mm")
     Arithmetic works as expected
    ulia> dtq + Quarter(3)
    ulia> Date(dtq)
     1990-04-01
    
  • A YearlyDate <: TimeType type (for the sake of consistency)

    ulia> using Dates, PeriodicalDates
    ulia> dty = YearlyDate(1990)
     Arithmetic works as expected
    ulia> dty + Year(1)
    ulia> Date(dty)
     1990-01-01
    

Please open an issue or submit a pull request if you need more methods to be defined.

This package was formerly registered under the name MonthlyDates.jl