Skip to content

Request: "largest unit" time format option #23

Open

Description

@sparr

#22 fixes a problem with times below 24 hours returning an empty string instead of "0 days", but that's a bare minimum fix. "0 days" is still not very helpful. Currently we have to specify whether we want D, D+H+M, or D+H+M+S, leaving it up to the caller to figure out which granularity is appropriate.

I propose here a wrapper or alternative to PrintDateDelta that returns just the most prominent unit. For times over 24 hours, it will return day(s). For 1-24 hours, hours. For 1-60 minutes, minutes. And for 1-60 seconds, seconds.

I'd be happy to implement this if it's a welcome feature.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions