I'm trying to display a clock that updates every second (e.g. 1/5/2015 12:05:01 then 1/5/2015 12:05:02, etc.) using moment.js.
I found previous solutions to my question (see Dynamic date and time with moment js and setinterval), however it doesn't work with the newest version of moment.js (v2.11.0). The solution provided uses v2.6.
Can someone advise?
A working compact solution.
JSFiddle
HTML
JavaScript
it seems to work fine for me. For the same code. And only the moment.min.js pointed to v2.11.0
Have a look at the code(credits: to MilkyWayJoe)-
Working fiddle with v2.11.0 - JSFiddle Demo
The previous solution you mentioned does work for moment.js v2.11.0.
Code:
See JSFiddle
However the JSFiddle in that accepted answer with the previous solution does not work giving the following error.
It can be fixed by simply loading the script from a proper CDN like so: