Skip to content

Commit 63d4bda

Browse files
teunbrandthomasp85
andauthored
Apply suggestions from code review
Co-authored-by: Thomas Lin Pedersen <[email protected]>
1 parent 8606347 commit 63d4bda

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

R/scale-date.R

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -370,8 +370,7 @@ ScaleContinuousDatetime <- ggproto("ScaleContinuousDatetime", ScaleContinuous,
370370
), call = self$call)
371371
}
372372
if (inherits(x, "Date")) {
373-
cli::cli_abort("You supplied a {.cls {class(x)}} field.
374-
Did you mean to use {.fn scale_*_date}?", call = self$call)
373+
x <- as.POSIXct(x)
375374
}
376375
ggproto_parent(ScaleContinuous, self)$transform(x)
377376
},
@@ -421,8 +420,7 @@ ScaleContinuousDate <- ggproto("ScaleContinuousDate", ScaleContinuous,
421420
), call = self$call)
422421
}
423422
if (inherits(x, "POSIXct")) {
424-
cli::cli_abort("You supplied a {.cls {class(x)}} field.
425-
Did you mean to use {.fn scale_*_datetime}?", call = self$call)
423+
x <- as.Date(x)
426424
}
427425
ggproto_parent(ScaleContinuous, self)$transform(x)
428426
},

0 commit comments

Comments
 (0)