Uploaded image for project: 'ZK'
  1. ZK
  2. ZK-4851

Datebox fails with default DateFormat from Java 11.0.2+


    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • 9.6.0
    • Freshly, 9.6.0
    • Components
    • Security Level: Jimmy

      Steps to Reproduce

      run current 9.6.0 FL with a datebox:





      Current Result

      Datebox receives an unusable format: "Apr 2, 1"

      Received from server-side (with a browser request for "Accept-Language: en-US,en;q=0.9,fr;q=0.8"

      receieved: ['zul.db.Datebox','mCCU0*',{format:'MMM d, y'* ...

      Since default format uses a 1 digit year, selecting a date in 2021 in the datebox popup will actually set a date of 2001


      no value, open current day:


      Selecting a value in current month, parsed value in 2001:

      Expected Result

      Default return a usable format

      Debug Information

      behavior introduced in https://tracker.zkoss.org/browse/ZK-4745

      Before this feature implementation, the client widget would still receive the format string with a single y digit, but would ignore it and treat "y" as "yy" for the purpose of displaying the date.

      Not sure if that was a bug or an existing workaround.


      JVM 11+ uses the unicode standard for date / time formats.

      See here:


      (warning big page, open in FF if fails in chrome) 


      DateFormat.DEFAULT is used in datebox:


      It resolves to DateFormat.MEDIUM




      according to java9 release note: https://www.oracle.com/java/technologies/javase/9-relnotes.html#JDK-8008577

      setting java.locale.providers to a value with COMPAT ahead of CLDR.


      The property "java.locale.providers" is only read at the Java runtime startup, so the later call to System.setProperty() won't have effect. (See LocaleServiceProvider API ).

      or just specify format: 

      <datebox format="yyyy/MM/dd"/>


            Leon03 Leon03
            MDuchemin MDuchemin
            0 Vote for this issue
            3 Start watching this issue