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

datebox contraint position after_* or before_* wrongly parsed by SimpleDateConstraint

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Normal
    • Resolution: Fixed
    • Affects Version/s: 6.5.1
    • Fix Version/s: 6.5.2
    • Component/s: None

      Description

      When trying to set the position of the constraint on a datebox with 'after_start', 'after_end', 'before_start' or 'before_end'

      <datebox constraint="no empty, before_start"/>

      it throws an Exception

      org.zkoss.zk.ui.UiException: Not a date: _start. Format: yyyyMMdd
      	at org.zkoss.zul.SimpleDateConstraint.parseDate(SimpleDateConstraint.java:148)

      Whereas the positions 'start_after', 'start_before', 'end_after' or 'end_before' works.

      The problem is in the parseConstraint method of org.zkoss.zul.SimpleDateConstraint, where its checks if the constraint start with 'before'/'after', then tries to parseDate the end of the constraint.

       else if (constraint.startsWith("before")) {
      			_end = parseDate(constraint.substring(6));
      			return 0;
      		} else if (constraint.startsWith("after")) {
      			_beg = parseDate(constraint.substring(5));
      			return 0;
      		}
      

      A solution would be to check if the constraint is a position 'before_', 'after_', ... or to check if the end of the constraint starts with ''.

        Attachments

          Activity

            People

            • Assignee:
              jumperchen jumperchen
              Reporter:
              al3x52 al3x52
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: