Details
-
Suggestion
-
Resolution: Unresolved
-
None
-
0
-
Description
Problem
Add some validator and warning message in JIRA when a user enters a date (year part) using dd/MM/yy, while the input date format is set to dd/MM/yyyy
Steps to Reproduce:
- Go to Administration > General Configuration > Advanced.
- Change the jira.date.picker.java.format from d/MMM/yy to dd/MM/yyyy.
- Create or edit an issue and type a number date in the Due Date field with format d/m/yy such as 1/1/14 for example
- Then click create or edit.
- After it is created or updated, go to the issue and click edit.
Actual Results:
The date typed is accepted and the Due Date field is storing 01/01/0014 instead of 2014.
Suggestion
Add some validator and warning message in JIRA UI when a user enters a date using dd/MM/yy, while the input date format is set to dd/MM/yyyy, so that the wrong year does not get set in JIRA.
Notes
It was decided in this original bug ticket that this behavior was actually not a bug, but an expected behavior due to the following reason:
For parsing, if the number of pattern letters is more than 2, the year is interpreted literally, regardless of the number of digits. So using the pattern "MM/dd/yyyy", "01/11/12" parses to Jan 11, 12 A.D.
source:
- http://docs.oracle.com/javase/6/docs/api/index.html?java/text/SimpleDateFormat.html
- https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/text/SimpleDateFormat.html
Having said that, in order to avoid any confusion for JIRA users, it would be great to do a check on JIRA side on the input data before the date gets processed in the backend by the Java class.
Attachments
Issue Links
- is related to
-
JRASERVER-36354 No Validation and wrong year when input year using Manual type in the date picker fields.
- Closed
-
JRASERVER-73865 Creating an issue with invalid date format causes data inconsistency in MS SQL Server due to datetime2 conversion out-of-range error
- Gathering Impact