commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sebb (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (LANG-1089) FastDateParser does not handle excess hours as per SimpleDateFormat
Date Mon, 02 Mar 2015 11:55:04 GMT

    [ 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)

Mime
View raw message