-
Bug
-
Resolution: Fixed
-
Normal
-
6.5.1
-
None
-
None
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 ''.