Coder Social home page Coder Social logo

Comments (3)

AlesJiranek avatar AlesJiranek commented on July 19, 2024

+1

from moment-duration-format.

jsmreese avatar jsmreese commented on July 19, 2024

Sorry for the delay on this... changed my notification settings for my new job back in March and I've missed a lot of stuff on this project.

You're expecting to be able to convert from duration months to duration milliseconds and back again. It's not my plugin doint this; Moment.Duration itself doesn't work like that.

moment.duration(2 * (moment.duration(1, 'months').valueOf())).asMonths();
// 1.9712930450317254

from moment-duration-format.

jsmreese avatar jsmreese commented on July 19, 2024

Interesting to note, Moment itself has modified this behaviour. Back in Moment 2.4, moment.duration(2 * (moment.duration(1, 'months').valueOf())).asMonths(); returned 2. The current Moment version returns 1.97...

I remember about a year ago helping with some issues around revamped Durations... pretty sure this change was a side-effect of their Duration revamp, and entirely intentional.

from moment-duration-format.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.