Skip to content

[Feature request] duration.asObject() #2971

@KaKi87

Description

@KaKi87

Hi,

It would be nice to have an asObject method on durations, e.g. to convert a number of milliseconds into { years, months, weeks, days, hours, minutes, seconds }.

That would be a shorthand for the following :

const durationAsObject = duration => ({
    years: duration.years(),
    months: duration.months(),
    days: duration.days(),
    hours: duration.hours(),
    minutes: duration.minutes(),
    seconds: duration.seconds()
});

Thanks

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