Compare date in body to date offset

I need to test that a date in the body “tokenExpiry” is at least 24 hours from now. My initial thought was to set an environment variable from which to compare, but I suspect there might be an easier way?

“success”: true,
“message”: “Authenticated”,
“token”: {
“token”: “abcde123”,
“tokenExpiry”: “2020-12-09T10:46:59.7611225Z”

Welcome to the community!

Give a try with the below code.

var response = pm.response.json();
var tokenExpiry = response.tokenExpiry;
tokenExpiry = Date.parse(tokenExpiry);
var currentDate = new Date(;
var expectedDate = new Date(currentDate.setDate(currentDate.getDate() + 1));
expectedDate = Date.parse(expectedDate);