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

Choosing Jan 1st, 1900 results in wrong year in format yy Datebox

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.5.8.1
    • Fix Version/s: 8.6.2
    • Component/s: Components
    • Labels:

      Description

      Steps to Reproduce

      open in zkfiddle

      <zk>
          <datebox format="dd/MM/yyyy"/>
          <datebox format="dd/MM/yy"/>
      </zk>
      
      1. Open datebox to choose Jan 1st, 1900
      2. Open datebox again

      Current Result

      dd/MM/yyyy => 1st Jan, 1900
      dd/MM/yy => 1st Jan, 2000

      Expected Result

      dd/MM/yyyy => 1st Jan, 1900
      dd/MM/yy => 1st Jan, 1900

      Since the date is by choice, not by inputting. Should have confidence about the year.

      Debug Information

      https://github.com/zkoss/zk/blob/v8.6.1/zul/src/archive/web/js/zul/db/Datebox.js#L766
      https://github.com/zkoss/zk/blob/v8.6.1/zul/src/archive/web/js/zul/inp/InputWidget.js#L806
      When a date is chosen, it will call updateChange_ which is called _validate to coerce from text

      Workaround

      Avoid using yy only in format.

        Attachments

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - 4 hours
                  4h
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h