Open Johnson-Yee opened 3 years ago
Hi! This is a result of using Java's Calendar and LocalDateTime API, where it accepts dates that appear to be invalid as it adds on leftover days to the next month. (i.e in this case, where you entered 2020-10-38, there are 7 leftover days that is then added to the month of November). This is something that we cannot change as a result of using these APIs. Thank you for bringing this issue up.
Team chose [response.Rejected
]
Reason for disagreement: During parsing, the invalid date should be flagged out as an exception by the program and not accepted as a valid input. As observed for both cases of the mentioned API, custom exceptions can be thrown when dates are invalid. In both cases, exception handling can be implemented.
1.LocalDateTime : throws DateTimeException
"Calendar has two modes for interpreting the calendar fields, lenient and non-lenient. When a Calendar is in lenient mode, it accepts a wider range of calendar field values than it produces. When a Calendar recomputes calendar field values for return by get(), all of the calendar fields are normalized. For example, a lenient GregorianCalendar interprets MONTH == JANUARY, DAY_OF_MONTH == 32 as February 1.
When a Calendar is in non-lenient mode, it throws an exception if there is any inconsistency in its calendar fields. For example, a GregorianCalendar always produces DAY_OF_MONTH values between 1 and the length of the month. A non-lenient GregorianCalendar throws an exception upon calculating its time or calendar field values if any out-of-range field value has been set."
Team chose [severity.VeryLow
]
Originally [severity.High
]
Reason for disagreement: This is not a cosmetic flaw and this bug affects the use of the program. It is a flaw that causes occasional inconvenience to some users but they can continue to use the product. This is because users might key in wrong dates that are accepted by the program. This could lead to unforeseen circumstances such as missing important deadlines. Hence, I believe that the severity level should be medium.
Issue description Did not catch wrong date and even accepted it as another date
Steps to reproduce the issue
What’s the expected result? Exception handling stating date is not accepted
What’s the actual result?