SeverinDK / moment-timer

Timer plugin for Moment.js that allows creation of setInterval and setTimeout-like timers.
MIT License
110 stars 33 forks source link

moment 2.23.0 breaks moment-timer #26

Open mxmzb opened 5 years ago

mxmzb commented 5 years ago

Since moment 2.23.0 there is no timer property on the result of moment.duration(args), which breaks this plugin.

Kachilero commented 5 years ago

I'm on moment 2.24.0 and this is still an issue. Is this repo abandoned?

JohnArcher commented 4 years ago

In my TypeScript project I get the error Only a void function can be called with the 'new' keyword.

Is that the same problem you have, @mxmzb and @Kachilero ?

alvaro-canepa commented 4 years ago

Is there any alternative to this package?

alvaro-canepa commented 4 years ago

Solved using my forked version. Only change dependency version to "moment": "<2.3.0".

yarn add https://github.com/alvaro-canepa/moment-timer.git

Edited A better way to solve this issue. It work for me. Add this to package.json and run yarn install --force.

"resolutions": {
    "moment": "~2.24.0"
  }
justbill2020 commented 3 years ago

Hey everyone... I just wanted to let everyone know... this works in the browser correctly using momentjs v 2.29.1, it only didn't work in nodejs. I did some research and found that I was not loading momentjs properly in nodejs.

We must use require.js and configure the package correctly to use momentjs in node. per the docs: https://momentjscom.readthedocs.io/en/latest/moment/00-use-it/04-require-js/

I've updated my forked repo and included the current release of momentjs and requirejs in the /example/vendor folder, I also created a nodejs example to illustrate how it functioned correctly.

If you clone my repo, and run node /example/nodejs/index.js you will see that it functions correctly.

Hope this helps everyone.

SeverinDK commented 3 years ago

Hey everyone... I just wanted to let everyone know... this works in the browser correctly using momentjs v 2.29.1, it only didn't work in nodejs. I did some research and found that I was not loading momentjs properly in nodejs.

We must use require.js and configure the package correctly to use momentjs in node. per the docs: https://momentjscom.readthedocs.io/en/latest/moment/00-use-it/04-require-js/

I've updated my forked repo and included the current release of momentjs and requirejs in the /example/vendor folder, I also created a nodejs example to illustrate how it functioned correctly.

If you clone my repo, and run node /example/nodejs/index.js you will see that it functions correctly.

Hope this helps everyone.

Feel free to open a Pull Request with these changes. I'll be happy to have a look and merge it into the repo. Have not been paying much attention to this for some time, but see there is still life, so this should be addressed.

justbill2020 commented 3 years ago

Will do, if you need additional contributors I’m totally willing @SeverinDK! Thank you!

SeverinDK commented 3 years ago

Will do, if you need additional contributors I’m totally willing @SeverinDK! Thank you!

I have sent you an invite 👍 Welcome aboard!

JakubChimiak commented 2 years ago

Hey everyone... I just wanted to let everyone know... this works in the browser correctly using momentjs v 2.29.1, it only didn't work in nodejs. I did some research and found that I was not loading momentjs properly in nodejs.

We must use require.js and configure the package correctly to use momentjs in node. per the docs: https://momentjscom.readthedocs.io/en/latest/moment/00-use-it/04-require-js/

I've updated my forked repo and included the current release of momentjs and requirejs in the /example/vendor folder, I also created a nodejs example to illustrate how it functioned correctly.

If you clone my repo, and run node /example/nodejs/index.js you will see that it functions correctly.

Hope this helps everyone.

Hi, for me that seems like not working, Im using moment@2.29.1 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'fn') Could someone take a look please?