Assert a date in format (e.g. MM-DD-CCYY) = date in a format (e.g. CCYY-MM-DDTHH24:MI:SSZ)
I have a PATCH REST request (json type payload) which contains a requiredByDate attribute with a date value with format MM-DD-CCYY
The follow up GET REST json response contains the requiredByDate attribute, but the value is transformed from MM-DD-CCYY to CCYY-MM-DDTHH24:MIS format.
I need to verify the date is correct with the new date format, but I've no idea how to do this - I'm guessing a small script assertion might do the job - but I really have no idea how to proceed - although i did have a go....
I tried putting a script assertion together against the GET request (after saving the PATCH request's date in a Properties step) knowing I wouldnt get absolutely right - but I wanted to give it a go anyway and this is what I got:
Obviously the assertion fails - because I'm saying 07-29-2019 is the same as '2019-07-29T00:00:00'
the results of the logging in the snippet is as follows:
Tue Oct 22 20:01:58 BST 2019: INFO: 07-29-2019
Tue Oct 22 20:01:58 BST 2019: INFO: 2019-07-29T00:00:00Z
Would anyone know how I can assert a date in one format (e.g. MM-DD-CCYY) is equivalent to the date in a different format (e.g. CCYY-MM-DDTHH24:MISZ)?
I hope I've been clear in my request
Thanks to all!
if this helped answer the post, could you please mark it as 'solved'? Also if you consider whether the title of your post is relevant? Perhaps if the post is solved, it might make sense to update the title of the post to something more descriptive? This will help people when searching for problems.