Hi I can set time in variable in postman and increase it based on the currenttimestamp.
var moment = require("moment");
pm.environment.set('scopeInTime', moment().add(3, 'd').add(6, 'h').add(30, 'minutes').toISOString());
However I want to increase the time +4 hours after each time I sent the request.
I also know how to increase integers, but I could not figure out how it should work with timestamps.
postman.setEnvironmentVariable('call-key', Number(postman.getEnvironmentVariable("call-key"))+1);
I also tried without succes
var moment = require("moment");
var fromTime = pm.variables.get("fromTime");
pm.environment.set('fromTime', moment().toISOString().add(4, 'hours').valueOf(fromTime));
console.log("fromTime", fromTime);
What I am trying to let it work:
fromTime: 2020-01-01T00:00:00.746Z
toTime: 2020-01-01T04:00:00.746Z
And each time I sent this request, it should add 4 hour on both timestamps. For example:
fromTime: 2020-01-01T04:00:00.746Z
toTime: 2020-01-01T08:00:00.746Z