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

Greg Huber commented on WW-5175:
--------------------------------

Went over this again and what I have done does not seem correct. 

>From the docs a LocalDateTime : A date-time without a time-zone in the 
>ISO-8601 calendar system, such as 2007-12-03T10:15:30

The format will always be yyyy-mm-ddThh:mm:ss even for a US locale (the date 
and month are usually switched).

The correct code should be
{code:java}
} else if (java.time.LocalDateTime.class == toType) {
        DateTimeFormatter dtf = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
        try {
               return LocalDateTime.parse(sa, dtf);
        } catch (DateTimeParseException e) {
               throw new TypeConversionException("Could not parse date", e);
       }
 }
 {code}
It is only ever going to be able to convert a format of 
2020-03-20T00:00:00.000000, as if you switch the months/days around it fails on 
all my tests.

> Add basic LocalDateTime support
> -------------------------------
>
>                 Key: WW-5175
>                 URL: https://issues.apache.org/jira/browse/WW-5175
>             Project: Struts 2
>          Issue Type: Improvement
>          Components: Core
>    Affects Versions: 2.5.29
>            Reporter: Greg Huber
>            Priority: Minor
>             Fix For: 2.6
>
>
> Add basic LocalDateTime support ie for the LocalDateTime.now().



--
This message was sent by Atlassian Jira
(v8.20.7#820007)

Reply via email to