You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2015/03/02 12:55:04 UTC

[jira] [Commented] (LANG-1089) FastDateParser does not handle excess hours as per SimpleDateFormat

    [ https://issues.apache.org/jira/browse/LANG-1089?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14343081#comment-14343081 ] 

Sebb commented on LANG-1089:
----------------------------

The 'h' and 'k' formats display hour 0 as 12/24 respectively, so the code needs to convert 12/24 to 0 on input.

The code uses modulo arithmetic to handle the conversion from 12 => 0 and 24 => 0.
Modulo has the same result for 12/24, but behaves differently from SDF lenient mode when the values are greater than 12/24.

Furthermore, the code applies the modulo conversion to the 'h' and 'H' formats, instead of the 'h' and 'k' formats.

This was not picked up by the unit tests as there were no tests that covered the conditions.

> FastDateParser does not handle excess hours as per SimpleDateFormat
> -------------------------------------------------------------------
>
>                 Key: LANG-1089
>                 URL: https://issues.apache.org/jira/browse/LANG-1089
>             Project: Commons Lang
>          Issue Type: Bug
>            Reporter: Sebb
>
> FastDateParser does not do any validation of dates/times.
> It acts similarly to SimpleDateFormat (SDF) in lenient mode.
> However it does not generate the same output as SDF for input where the number of hours is greater than the normal range (e.g. > 12 for hh or > 23 for HH)



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)