library(tsibble)
#>
#> Attaching package: 'tsibble'
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, union
(yw <- yearweek("2020-01-01"))
#> <yearweek[1]>
#> [1] "2020 W01"
#> # Week starts on: Monday
format(yw, "%Y-%m-%d")
#> [1] "2020-12-30"
Created on 2021-05-12 by the reprex package (v2.0.0)
Because it operates as documented. Using the fine documentation in base R under
help(strptime)
:Which we can then test using
%Y-W
following by the option:What you get in your example are essentially just wrappers around the same functionality. Maybe
yearweek()
gives you a choice of convention; if not you now know how to build your own under a different option.