Skip to content

Arbitrary precision #3

@shazow

Description

@shazow

Any interest in adding support for arbitrary precision?

I imagine something like,

func (cfg Config) FormatPrecise(duration time.Duration, precision time.Duration) string

FormatPrecise(60 * time.Second, time.Second) == "60 seconds"
FormatPrecise(60 * time.Second, time.Minute) == "1 minute"
FormatPrecise(90 * time.Second, time.Second) == "1 minute and 30 seconds"
FormatPrecise(12345 * time.Second, time.Second) == "3 hours, 25 minutes, and 45 seconds"

Or perhaps for the sake of cross-language grammar simplicity, just 3 hours 25 minutes 45 seconds.

Alternatively this could be part of Config.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions