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

FR: don't print seconds in dttm if there is not enough space #647

Open
olivroy opened this issue May 26, 2023 · 1 comment
Open

FR: don't print seconds in dttm if there is not enough space #647

olivroy opened this issue May 26, 2023 · 1 comment

Comments

@olivroy
Copy link
Contributor

olivroy commented May 26, 2023

Hi,
I was wondering if it was possible not to print seconds if there are many columns (i.e. adaptative printing) in tibbles.

I use a custom version of pillar_shaft for dttm, but it never prints seconds.

  pillar_shaft.POSIXct <- function(x, ...) {
    width <- 17L
    date <- format(x, format = "%Y-%m-%d")
    time <- format(x, format = "%H:%M")
    datetime <- paste0(date, " ", pillar::style_subtle(time))
    datetime[is.na(x)] <- NA
    pillar::new_pillar_shaft_simple(datetime, width = width, align = "left")
  }

I was wondering if it would be possible to add this option to

pillar_shaft.POSIXt <- function(x, ...) {

@krlmlr
Copy link
Member

krlmlr commented Dec 14, 2024

Thanks. This looks useful, happy to review a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants