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

Using short format in Datebox results in the wrong year

XMLWordPrintable

    • ZK 8.6.2 S2

      Steps to Reproduce

      <zk>
      	<zscript><![CDATA[
      	Sessions.getCurrent().setAttribute("px_preferred_locale", new Locale("th","TH"));
      	]]></zscript>
      	<datebox onCreate="self.value = new Date();" format="short"/>
      	<button label="Click me after you test done" onClick='Sessions.getCurrent().removeAttribute("px_preferred_locale")' />
      </zk>
      
      1. Fiddle: http://zkfiddle.org/sample/3eq32v6/1-ZK-4242
      2. Open the datebox
      3. Check the calendar date

      Current Result

      In 2019/03/15 (15 มี.ค. 2562) It shows "15 มี.ค. 1962"

      Expected Result

      In 2019/03/15 (15 มี.ค. 2562) It shows "15 มี.ค. 2562"

      Debug Information

      https://github.com/zkoss/zk/blob/v8.6.1/zul/src/archive/web/js/zul/db/Datebox.js#L700
      It uses the text of textbox to parse the Date, which only has 2 digits in years.

      Workaround

      Use full year format instead (like dd MMM yyyy)

            rudyhuang rudyhuang
            rudyhuang rudyhuang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - 4 hours
                4h
                Remaining:
                Remaining Estimate - 4 hours
                4h
                Logged:
                Time Spent - Not Specified
                Not Specified