Skip to content

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

@olivroy

Description

@olivroy

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, ...) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancementhelp wanted ❤️we'd love your help!

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions