File tree Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Expand file tree Collapse file tree 4 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -433,6 +433,7 @@ S3method(vec_proxy_compare,clock_year_month_weekday)
433433S3method(vec_ptype,clock_iso_year_week_day)
434434S3method(vec_ptype,clock_naive_time)
435435S3method(vec_ptype,clock_sys_time)
436+ S3method(vec_ptype,clock_weekday)
436437S3method(vec_ptype,clock_year_month_day)
437438S3method(vec_ptype,clock_year_month_weekday)
438439S3method(vec_ptype,clock_year_quarter_day)
Original file line number Diff line number Diff line change @@ -157,6 +157,11 @@ vec_ptype_abbr.clock_weekday <- function(x, ...) {
157157
158158# ------------------------------------------------------------------------------
159159
160+ # ' @export
161+ vec_ptype.clock_weekday <- function (x , ... ) {
162+ clock_empty_weekday
163+ }
164+
160165# ' @export
161166vec_ptype2.clock_weekday.clock_weekday <- function (x , y , ... ) {
162167 x
@@ -506,3 +511,11 @@ reencode_western_to_iso <- function(code) {
506511 code [code == 0L ] <- 7L
507512 code
508513}
514+
515+ # ------------------------------------------------------------------------------
516+
517+ clock_init_weekday_utils <- function (env ) {
518+ assign(" clock_empty_weekday" , weekday(integer()), envir = env )
519+
520+ invisible (NULL )
521+ }
Original file line number Diff line number Diff line change 1515 clock_init_sys_time_utils(clock_ns )
1616 clock_init_naive_time_utils(clock_ns )
1717 clock_init_zoned_time_utils(clock_ns )
18+ clock_init_weekday_utils(clock_ns )
1819
1920 vctrs :: s3_register(" pillar::pillar_shaft" , " clock_calendar" , pillar_shaft.clock_calendar )
2021 vctrs :: s3_register(" pillar::pillar_shaft" , " clock_time_point" , pillar_shaft.clock_time_point )
Original file line number Diff line number Diff line change @@ -173,3 +173,10 @@ test_that("can't compare or order weekdays (#153)", {
173173 expect_snapshot_error(xtfrm(weekday(1 : 2 )))
174174 expect_snapshot_error(vec_order(weekday(1 : 2 )))
175175})
176+
177+ # ------------------------------------------------------------------------------
178+ # vec_ptype()
179+
180+ test_that(" ptype is correct" , {
181+ expect_identical(vec_ptype(weekday(1 : 7 )), weekday(integer()))
182+ })
You can’t perform that action at this time.
0 commit comments