PeriodicalDates.jl
PeriodicalDates.jl copied to clipboard
string literal macros
I got lazy again and found the construction of a single quarterly date is a bit tedious (QuarterlyDate(2020, 1)
). Do you consider adding string literal macros to the package? Here is my idea:
macro yq_str(ymstr)
return :(QuarterlyDate($ymstr))
end
macro ym_str(ymstr)
return :(MonthlyDate($ymstr))
end
so a QuarterlyDate(2020, 3)
can be simply constructed as yq"2020-Q3"
.
Maybe. Do these types of string literal macros to construct dates exist anywhere else?
Note that you can already do QuarterlyDate("2020-Q3")
Maybe. Do these types of string literal macros to construct dates exist anywhere else?
No. But I guess that's because Date
is relatively easy to type while QuarterlyDate
is pretty tedious.
Your call. I can also simply put it into my own header file.