Timestamp mismatch between Pre-request Script output and {{$isoTimestamp}} resolution
19K reputation · 08 May 2025, 04:08 UTC
Postman date handling across scripts and dynamic variables
Postman resolves dynamic variables such as {{$isoTimestamp}} at the moment of request transmission, producing a UTC ISO 8601 value. Pre-request Scripts, by contrast, run earlier in a JavaScript sandbox where the native Date object defaults to the local time zone of the machine running the client.
The goal is to send a request payload containing a timestamp converted to a specific regional time zone, while keeping it consistent with any value computed in the Pre-request Script. Because the two mechanisms evaluate time at different points and against different clocks (UTC versus local system time), the values can diverge, and hard-coding a fixed UTC offset breaks during Daylight Saving Time transitions. Assume a current Postman desktop client version; behavior should be verified against the installed release.
- How can a single regional timestamp be generated once and reused consistently in both the script logic and the request body?
- Is storing a converted value via
pm.environment.set()the reliable way to avoid the resolution-timing gap with dynamic variables? - How should Daylight Saving Time be handled without hard-coded offsets in the Postman sandbox?