Skip to content
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

Change leading characters in label_date_short() #456

Merged
merged 4 commits into from
Oct 21, 2024

Conversation

teunbrand
Copy link
Contributor

This PR aims to fix #442.

Briefly, adds an additional argument label_date_short() that swaps out leading zeroes with other characters.
Example:

devtools::load_all("~/packages/scales/")
#> ℹ Loading scales
x <- seq(Sys.Date(), Sys.Date() + 365, by = "2 months")
labels <- label_date_short(format = c("%Y", "%m", "%d", "%H:%M"), leading = "")
labels(x)
#> [1] "7\n10\n2024" "7\n12"       "7\n2\n2025"  "7\n4"        "7\n6"       
#> [6] "7\n8"        "7\n10"

Created on 2024-10-07 with reprex v2.1.1

@thomasp85 thomasp85 merged commit 8ca05e0 into r-lib:main Oct 21, 2024
12 checks passed
@teunbrand teunbrand deleted the date_leading_chars branch October 21, 2024 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: an option to remove leading zeros in label_date_short()
2 participants