Skip to content

Fixes #3533 - Swap date(time) types in opposite scale #6042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Mar 25, 2025
8 changes: 8 additions & 0 deletions R/scale-date.R
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,10 @@ ScaleContinuousDatetime <- ggproto("ScaleContinuousDatetime", ScaleContinuous,
i = "The value was converted to {obj_type_friendly(x)}."
), call = self$call)
}
if (inherits(x, "Date")) {
cli::cli_abort("You supplied a {.cls {class(x)}} field.
Did you mean to use {.fn scale_*_date}?", call = self$call)
}
ggproto_parent(ScaleContinuous, self)$transform(x)
},
map = function(self, x, limits = self$get_limits()) {
Expand Down Expand Up @@ -416,6 +420,10 @@ ScaleContinuousDate <- ggproto("ScaleContinuousDate", ScaleContinuous,
i = "The value was converted to {obj_type_friendly(x)}."
), call = self$call)
}
if (inherits(x, "POSIXct")) {
cli::cli_abort("You supplied a {.cls {class(x)}} field.
Did you mean to use {.fn scale_*_datetime}?", call = self$call)
}
ggproto_parent(ScaleContinuous, self)$transform(x)
},
get_breaks = function(self, limits = self$get_limits()) {
Expand Down
Loading