Skip to content

Commit c2dd04b

Browse files
committed
avoid date conversion for epiweek epiranges
1 parent 3255ac4 commit c2dd04b

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

R/model.R

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,11 @@ print.EpiRange <- function(x, ...) {
6969
x$to <- as.Date(as.character(x$to), "%Y%m%d")
7070
} else if (nchar(x$from) == 6) {
7171
date_type <- "Epiweeks" # nolint: object_usage_linter
72-
x$from <- format(
73-
as.Date(as.character(x$from), "%Y%U"),
74-
"%Yw%U"
72+
x$from <- paste0(
73+
substr(x$from, 1, 4), "w", substr(x$from, 5, 6)
7574
)
76-
x$to <- format(
77-
as.Date(as.character(x$to), "%Y%U"),
78-
"%Yw%U"
75+
x$to <- paste0(
76+
substr(x$to, 1, 4), "w", substr(x$to, 5, 6)
7977
)
8078
}
8179

0 commit comments

Comments
 (0)