Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to validate that a custom field containing a datetime is in the future?

Nick Hassell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2020

I am using Scriptrunner to validate a custom field.  This is a Date Time Picker field.

I have tried (issue.customfield_111111 > new Date()) but this does not appear to work.

1 answer

1 accepted

1 vote
Answer accepted
Nick Hassell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
January 15, 2020

I was eventually able to work out that the custom field simply contains a string in ISO date format.  So this needs to be converted to a Date object before a comparison can be made as follows:

(new Date(issue.customfield_111111) > new Date())

Suggest an answer

Log in or Sign up to answer