Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1680

FastDateFormat does not support the 'L'-Pattern from SimpleDateFormat

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Minor
    • Resolution: Fixed
    • 3.12.0
    • 3.12.0
    • lang.time.*
    • None
    • All

    Description

      The MMM-Pattern in SimpleDateFormat is context-sensitve. 

      If you execute

      {{FastDateFormat.getInstance("MMMyy", Locale.GERMAN).format(Calendar.getInstance())}}

      You get "Jan.22". Observer the dot after 'Jan'.  If you do the equivalent with SimpleDateFormat with 'LLLyy' instead as the pattern 

      {{new SimpleDateFormat("LLLyy", Locale.GERMANY).format(Calendar.getInstance().getTime());}}

      you get "Jan22" as expected. 

       

      If the 'L'-Pattern is used with FastDateFormat, it throws an IllegalArgumentException

      java.lang.IllegalArgumentException: Illegal pattern component: LLL    at org.apache.commons.lang3.time.FastDatePrinter.parsePattern(FastDatePrinter.java:311) 

      The Source shows that the L-Pattern is not implemented.

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            ribinux Michael Krause
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 2h 40m
                2h 40m