Skip to content

@DateTimeFormat(iso = ISO.DATE_TIME) should use optimized formatter for LocalDateTime [SPR-14958] #19525

Closed

Description

@spring-projects-issues

Oliver Drotbohm opened SPR-14958 and commented

It looks like the usage of DateTimeFormatter.ISO_DATE_TIME to format LocalDateTime instances is significantly slower than a usage of DateTimeFormatter.ISO_LOCAL_DATE_TIME (see this benchmark for details).

It would be cool if we could switch to that DateTimeFormatter in case a LocalDateTime instance is to be converted.


Affects: 4.3.4, 5.0 M3

Issue Links:

Activity

  1. spring-projects-issues commented on Nov 30, 2016

    @spring-projects-issues
    CollaboratorAuthor

    Juergen Hoeller commented

    We've got specific checks for printing LocalDate / LocalTime / LocalDateTime now, automatically switching to ISO_LOCAL_DATE / ISO_LOCAL_TIME / {{ISO_LOCAL_DATE_TIME}... but just for printing, not for parsing, since the non-local variants turn out to leniently strip zone information in an input string whereas the local variants strictly reject those. Since there is only a performance benefit in printing anyway according to my tests, this compromise should be alright.

  2. added
    type: enhancement
    in: core
    on Jan 11, 2019
  3. added this to the 4.3.5 milestone on Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

in: coretype: enhancement

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions