moment-timer icon indicating copy to clipboard operation
moment-timer copied to clipboard

moment 2.23.0 breaks moment-timer

Open mxmzb opened this issue 7 years ago • 9 comments

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

mxmzb avatar Dec 27 '18 19:12 mxmzb

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

Kachilero avatar Jul 26 '19 20:07 Kachilero

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 ?

JohnArcher avatar Apr 22 '20 15:04 JohnArcher

Is there any alternative to this package?

alvaro-canepa avatar May 03 '20 12:05 alvaro-canepa

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"
  }

alvaro-canepa avatar May 03 '20 12:05 alvaro-canepa

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.

justbill2020 avatar Feb 08 '21 17:02 justbill2020

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.

SeverinDK avatar Feb 10 '21 22:02 SeverinDK

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

justbill2020 avatar Feb 10 '21 22:02 justbill2020

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

I have sent you an invite 👍 Welcome aboard!

SeverinDK avatar Feb 11 '21 10:02 SeverinDK

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 [email protected] Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'fn') Could someone take a look please?

JakubChimiak avatar Jul 05 '22 09:07 JakubChimiak