Dynamic date and time with moment.js and setInterval

后端 未结 4 1471
忘了有多久
忘了有多久 2021-02-07 12:22

I\'m trying to find out how I can display dynamic date and time using moment.js.

Apparently I can\'t figure out to use setInterval properly.

If possible I\'d pre

4条回答
  •  暖寄归人
    2021-02-07 12:56

    Put

    date = moment(new Date());
    

    inside the update function. Now you're just printing the same date every second ;)

提交回复
热议问题