Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes show "0 seconds" #142

Open
ghost opened this issue May 17, 2020 · 0 comments
Open

Sometimes show "0 seconds" #142

ghost opened this issue May 17, 2020 · 0 comments

Comments

@ghost
Copy link

ghost commented May 17, 2020

When moment.duration is "604800000" it shows 1 week, but when moment.duration is "604800100", it shows 0 seconds instead of 1 week, 0 days, 0 hours, 0 minutes and 1 second.

image
image
image

const moment = require("moment");
require("moment-duration-format");
moment.updateLocale('en', {
    durationLabelsStandard: {
        s: "second",
        ss: "seconds",
        m: "minute",
        mm: "minutes",
        h: "hour",
        hh: "hours",
        d: "day",
        dd: "days",
        w: "week",
        ww: "weeks",
        M: "month",
        MM: "moths",
        y: "year",
        yy: "years"
    },
})
const duration = moment.duration("3660000").format(`y __, M __, w __, d __, h __, m __ [and] s __`);

console.log(duration)

@ghost ghost closed this as completed May 24, 2020
@ghost ghost reopened this May 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants