I have a NodeJS RabbitMQ consumer which creates a date using MomentJS. However because this runs constantly, the date is always the same.
How can I create a new date every time the consumer receives a message?
Should I wrap the call to
This could be done by initializing a new date when receiving a new message like
let newDate = new moment() console.log(newDate.unix())
Edit: Also working without the new keyword
let newDate = moment()
but better for readability and preventing some possible strange effects
let newDate = moment(new Date())