Script Field - Date Time Picker always returns $datePickerFormatter.format($value)

Mahek Mody December 18, 2017

code I have tried

def last_test_date = Date.parse("yyyy-MM-dd hh:mm:ss", "2014-04-03 1:23:45")

return last_test_date 

 

return "12-13-2017"

return "13-12-2017"

return "12/13/2017"

return "12/Dec/2017"

 

Nothing seems to work.

1 answer

1 accepted

1 vote
Answer accepted
Joanna Choules
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.
December 20, 2017

Hi Mahek,

Which searcher are you using for this script field? Your first example (where you return a Date object) should work correctly, so long as you make sure that the searcher is set to 'Date Time Range picker'.

Yours,

Jake

Mahek Mody December 21, 2017

I don't get "Date Time Range Picker" as an option.

I am using "Date Time Picker" - Same result

Joanna Choules
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.
December 22, 2017

Hi Mahek,

'Date Time Picker' is one of the available templates for a script field, but you also need to select the right searcher, which in this case is 'Date Time Range picker'. You can select the searcher as follows:

  1. Go to the Script Fields tab, where all of your script fields are listed.
  2. Locate the field you want to configure. In the left-hand column are listed the configuration scheme, the searcher, and the template (see first image below for an example).
  3. Click on the name of the searcher, and you will be taken to a page where you can edit the field's details (see second image).
  4. Select 'Date Time Range picker' from the 'Search Template' drop-down and submit the form.

Image 1

Screen Shot 2017-12-22 at 11.21.02.png

Image 2

Screen Shot 2017-12-22 at 11.18.43.png

Mahek Mody December 23, 2017

Perfect!

That is the issue, the problem is fixed.

Thanks Jake. Appreciate the effort.

Joanna Choules
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 2, 2018

Hi Mahek,

I'm glad to hear that the problem is resolved. If you find this answer to be useful, please consider accepting it so that other users of Community who may be having the same issue as you will be able to see that there is a solution available.

Many thanks,

Jake

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events