Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-7121

Support for custom global Joda DateTimeFormatters

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: 3.0.2
    • Fix Version/s: 3.2 RC1
    • Component/s: Core
    • Last commented by a User:
      false

      Description

      I'd like to be able to configure the Joda Time parser globally, to parse all the dates in common format. There is no documentation on it. In my case I'd like to have it configured so that it parses all dates and times in valid ISO format (org.joda.time.format.ISODateTimeFormat.dateTimeParser() | dateParser() | dateOptionalTimeParser() | timeParser()). I was able to write my own converter to do it, but if Spring has JodaTime support built-in, than I'd expect to be able to do it without writing any code.
      In my case, we have RESTful service based on Spring. All dates which are accepted by the service must be in ISO format. Then, it makes sense to set this format once, globally, in spring context config file probably.

        Issue Links

          Activity

          Hide
          cbeams Chris Beams added a comment -

          Juergen Hoeller, perhaps you'd like to take a look at Phil's pull request at https://github.com/SpringSource/spring-framework/pull/161? If so, assign and schedule as you see fit.

          Show
          cbeams Chris Beams added a comment - Juergen Hoeller , perhaps you'd like to take a look at Phil's pull request at https://github.com/SpringSource/spring-framework/pull/161? If so, assign and schedule as you see fit.
          Hide
          pwebb Phil Webb added a comment -

          Grzegorz Borkowski I have added dateFormatter, timeFormatter and dateTimeFormatter properties to JodaTimeFormatterRegistrar that can be used to specify global formatters. There is also a new DateTimeFormatterFactory class that can be used to create them.

          You will need to configure JodaTimeFormatterRegistrar directly rather than using DefaultFormattingConversionService. I plan to document how to do this before 3.2 goes GA (see SPR-9952).

          Show
          pwebb Phil Webb added a comment - Grzegorz Borkowski I have added dateFormatter , timeFormatter and dateTimeFormatter properties to JodaTimeFormatterRegistrar that can be used to specify global formatters. There is also a new DateTimeFormatterFactory class that can be used to create them. You will need to configure JodaTimeFormatterRegistrar directly rather than using DefaultFormattingConversionService . I plan to document how to do this before 3.2 goes GA (see SPR-9952 ).

            People

            • Assignee:
              pwebb Phil Webb
              Reporter:
              grzegorzborkowski Grzegorz Borkowski
              Last updater:
              Sam Brannen
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                5 years, 3 weeks, 6 days ago