Hi,
We have a monitor that runs every 30 minutes set to run in the “UK” region. One of the tests calls an endpoint with tomorrow’s date as a query string parameter, expecting it to fail, as tomorrow is invalid for this endpoint (it doesn’t have data after today). This test is failing between 00:00 and 01:00 local time (UK/BST). I suspect this is because the monitor is actually running on GMT/UTC time, not UK time. The test passes when I run it at that time in the collection.
When the monitor ran this morning at 00:00 and 00:30, the query parameter was evaluated to today’s date (22nd June):
date=2022-06-22
Only when it reached 01:00, the query parameter became
date=2022-06-23
The endpoint being called does correctly evaluate tomorrow’s date at local time, i.e. at 00:00, the date for tomorrow fails to return data as expected (i.e. on 22nd at 00:00, calling with 23rd as input fails to return data, and similarly on 21st at 23:00, calling with 22nd as input fails to return data).
Here’s the code I’m using to generate the query parameter:
var moment = require('moment');
var now = moment();
now.add(1, 'days')
var tomorrowLocalDate = now.format('YYYY-MM-DD');
pm.environment.set('tomorrowLocalDate', tomorrowLocalDate)
Thank you
David