1

In my pre-request script section I am simply doing:

const moment = require('moment');
console.log(moment().add(1,'minutes').format("YYYY-MM-DD HH:MM"));
console.log(moment().add(2,'months').format("YYYY-MM-DD HH:MM"));

Which outputs:

2020-07-29 22:07
2020-09-29 22:07

However, subsequent calls to that endpoint do not update the time it always stays at 22:07 even though the time is now 22:28.

Am I missing something?

Thanks

Elliot Reeve
  • 901
  • 4
  • 21
  • 39

1 Answers1

1

You need to use the correct format mm not MM as per the official DOCS to achieve the desired results.

Run snippet below.

let addMin = moment().add(1,'minutes').format("YYYY-MM-DD HH:mm")
console.log(addMin);

let addMonth = moment().add(2,'months').format("YYYY-MM-DD HH:mm")
console.log(addMonth);
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.23.0/moment.min.js"></script>
Always Helping
  • 14,316
  • 4
  • 13
  • 29