# date coercion
as_isoweek(Sys.Date())
# POSIXt coercion
as_isoweek(as.POSIXct("2019-03-04 01:01:01", tz = "America/New_York"))
# character coercion assumes date input by default
as_isoweek("2019-05-03")
# character coercion can handle YYYY-Www format too
as_isoweek("2019-W12", format = "yearweek")
# construction
isoweek(year = 2000, week = 3)
# direct construction
stopifnot(
identical(
new_isoweek(0:1),
as_isoweek("1969-12-29") + 0:1
)
)
Run the code above in your browser using DataLab