tidyverts / tsibble

Tidy Temporal Data Frames and Tools
https://tsibble.tidyverts.org
GNU General Public License v3.0
530 stars 49 forks source link

yearquarter format #279

Closed arnaud-feldmann closed 1 year ago

arnaud-feldmann commented 2 years ago

Yearquarter strings usually depend of locale. That is, in my language (French), the dates would often be in in the "2020T4" format (T for trimestre)

Could it be possible to get a format arg ?

yearquarter("2020T4")
#<yearquarter[1]>
#[1] "2020 Q2"
yearquarter("2020Q4")
#<yearquarter[1]>
#[1] "2020 Q4"
earowang commented 1 year ago

You can use the format arg in the format() function to have the desired display, but not the input of yearquarter().

format(tsibble::yearquarter("2020T4"), format = "%YT%q")
#> [1] "2020T2"

Created on 2022-10-09 with reprex v2.0.2