Question regarding date values in postman-to-k6 converted scripts #123
Answered
by
prabodhkelkar
prabodhkelkar
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
prabodhkelkar
Mar 28, 2024
Replies: 1 comment
-
Found the solution: Instead of moment() use Date()
This method returns date in "YYYY-MM-DD" format (e.g. "2024-03-28")
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
prabodhkelkar
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Found the solution:
Instead of moment() use Date()
Created below method to do date additions.
const getDate = (days) => { const startDate = new Date() startDate.setDate(startDate.getDate() + days) return startDate.toISOString().slice(0, 10) }
This method returns date in "YYYY-MM-DD" format (e.g. "2024-03-28")
Calling this method to initiate Collection Variables: