Skip to content

feat: add .duration and .time_ago inline styles #814

@jjjermiah

Description

@jjjermiah

find myself frequently formatting elapsed times and relative timestamps when building clis and storing them in the user_themes option, it would be useful to support these out of the box.

  • .duration : format seconds/timediff as human-readable duration
    i.e {.duration {elapsed}} -> [2m 3s] / [42s]
  • .time_ago : format as relative time string
    i.e {.time_ago {ts}} -> "2 minutes ago"

both can take advantage of vendored formatters in the package R/time.R and R/time-ago.R without dependencies, and would be consistent with the .bytes feature from #740

Metadata

Metadata

Assignees

No one assigned

    Labels

    featurea feature request or enhancement

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions