Date/Time Custom field reverts to an incorrect date after submission of the value
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Summary
Consider a Date/Time Custom field, say, FirstRewiewDate. If we create a new issue and enter a specific value, "08/Mar/23 10:18 AM," for the custom field FirstRewiewDate, we will observe an incorrect value for this field when viewing the issue. The same thing happens while editing the custom field value; it reverts to an incorrect value.
Diagnosis
Verify from the DB, the value for custom field FirstRewiewDate for an issue by using the below query:
1
2
3
4
5
6
select * from customfieldvalue where customfield=(select id from customfield where cfname='<custom_field_name>') and issue= (select ji.id from jiraissue ji join project p on ji.project=p.id and p.pkey||'-'||ji.issuenum='<issue-key>') ;
<custom_field_name> is the name of the impacted customfield
<issue-key> is key of the issue to be checked
Note: The query is designed for postgres DB
The DB will also show the incorrect value stored for the custom field. This will help in discarding any javascript causing incorrect display on the UI only.
The same behavior will be observed for all the Date/Time Custom Fields and the behavior is not specific to one such field.
Cause
If the default value for parameters of Date/Time Format under Administration > System > Advanced Settings are modified in such a way that they contradict each other for Java and JavaScript, it can cause the incorrect value of Date/Time CustomFields.
Example: If the parameter jira.date.time.picker.javascript.format has the value %Y-%m-%d %I:%M %p and jira.date.time.picker.java.format has value yyyy-MMM-dd hh:mm aa.
It will cause an issue as to match the month format MMM of java format %b needs to be used in javascript format, so correct javascript format should be %Y-%b-%d %I:%M %p
Solution
Revert to the default values by clicking on the Revert button or use the correct and same format for both javascript and java date/time parameters.
Was this helpful?