Hi,
My JIRA Server's default TimeZone is (GMT-06.00) Chicago. A user located in a different geographic location sets his user profile to different TZ, say, America -> Denver. My JIRA Server uses UTC time.
We've 2 date picker customfields in JIRA that provide a date range. When user changes his TZ to his local TZ (other than JIRA Server's default TZ) and sets the value of these date picker customfields to current date 14/Jul/14, the velocity code dealing with these customfields outputs 13/Ju/14. Below is the velocity code -
#set($serviceStartDateId = 'customfield_10702') #set($serviceStartDateField = $customFieldManager.getCustomFieldObject($serviceStartDateId)) #set($serviceStopDateId = 'customfield_10703') #set($serviceStopDateField = $customFieldManager.getCustomFieldObject($serviceStopDateId)) #if($issue.getCustomFieldValue($serviceStartDateField) && $issue.getCustomFieldValue($serviceStopDateField)) #set($serviceStartDateFieldValue = "") #set($serviceStartDateFieldValue = $issue.getCustomFieldValue($serviceStartDateField)) #set($serviceStopDateFieldValue = "") #set($serviceStopDateFieldValue = $issue.getCustomFieldValue($serviceStopDateField)) #set($serviceStartFormatDMY = $outlookdate.formatDMY($serviceStartDateFieldValue)) #set($serviceStopFormatDMY = $outlookdate.formatDMY($serviceStopDateFieldValue))
How can the date entered in the date picker customfield be rendered as is i.e., 14/Jul/14 and not 13/Jul/14. This is creating problems in further code which pulls information based on the date picker field's value.
Any help is much appreciated.
Thanks,
Naren.
Community moderators have prevented the ability to post new answers.
Dear Naren,
I'm stuck with the same issue as you.
If you have already find the solution, could you please share it with me?
Best Regards,
Masaya
Upon debugging the velocity code, I found following -
After setting the TZ to the local TZ and updating the date picker custom fields to the current date - 14/Ju/14. JIRA displays the dates properly. Also in the above velocity code, the $serviceStartDateFieldValue and $serviceStopDateFieldValue outputs the values properly in i.e., 2014-07-14 00:00:00.0.
However, the below 2 lines changes the date to the TZ in which the current user is logged in -
#set($serviceStartFormatDMY = $outlookdate.formatDMY($serviceStartDateFieldValue)) #set($serviceStopFormatDMY = $outlookdate.formatDMY($serviceStopDateFieldValue))
The $outlookdate.formatDMY seems to be rendering the TZ to the currently logged in user's TZ. I'm exploring further if we can render the date picker values in velocity, as is, irrespective of change in the user's TZ.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.