Postman TodayDate variable to get past dates

@mattschmitt No problem :blush: I thought any past date would work for you.

So please try the below snippet then:

const moment = require('moment');
const today = moment();
var todayDate = today.format('YYYYMMDD');
pm.globals.set("todayDate", todayDate);

var tenDaysBack = moment().subtract(10, 'days');
//console.log(tenDaysBack);
pm.globals.set("tenDaysBack", tenDaysBack.format('YYYYMMDD'));


Please let me know if you still face any issues here :slightly_smiling_face:

3 Likes