VALID_TIME / VALID_DATE accepts invalid times / dates

Document ID : KB000087390
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
Error Message :
N/A

The VALID_TIME script function validates invalid times and the VALID_DATE function validates invalid DATES.

Example:

For  "2017-06-01ABC" the VALID_DATE function returns a "Y" as a result indicating that the value "2017-06-01ABC" is a valid date, which it is not. The same goes for VALID_TIME.  If an invalid type is entered, the function returns a "Y" indicating it is valid.

Investigation
  1. Execute the following script in a SCRI-object:
:SET &PATTERN# = "HH:MM:SS"
:SET &TIME_1# = "12:00:00"
:SET &TIME_2# = "120000"
:SET &TIME_3# = "ABCDEF"
:SET &TIME_4# = "12:00:00ABC"

:IF VALID_TIME("&PATTERN#;&TIME_1#") = "Y"
: PRINT " VALID: &PATTERN# >&TIME_1#<"
:ELSE
: PRINT "INVALID: &PATTERN# >&TIME_1#<"
:ENDIF

:IF VALID_TIME("&PATTERN#;&TIME_2#") = "Y"
: PRINT " VALID: &PATTERN# >&TIME_2#<"
:ELSE
: PRINT "INVALID: &PATTERN# >&TIME_2#<"
:ENDIF

:IF VALID_TIME("&PATTERN#;&TIME_3#") = "Y"
: PRINT " VALID: &PATTERN# >&TIME_3#<"
:ELSE
: PRINT "INVALID: &PATTERN# >&TIME_3#<"
:ENDIF

:IF VALID_TIME("&PATTERN#;&TIME_4#") = "Y"
: PRINT " VALID: &PATTERN# >&TIME_4#<"
:ELSE
: PRINT "INVALID: &PATTERN# >&TIME_4#<"
:ENDIF

 
Results

Actual:   TIME_1, TIME_2 and TIME_3 are evaluated correctly, but TIME_4 is evaluated as Y, which indicates it is a valid format, which it is not.
 
2017-05-24 15:24:37 - U00020408 VALID:   HH:MM:SS >12:00:00<
2017-05-24 15:24:37 - U00020408 INVALID: HH:MM:SS >120000<
2017-05-24 15:24:37 - U00020408 INVALID: HH:MM:SS >ABCDEF<
2017-05-24 15:24:37 - U00020408 VALID:   HH:MM:SS >12:00:00ABC<

Expected:   Since TIME_4 contains an invalid time it should be evaluated as an N, which indicates it is an invalid format.
Environment:
OS Version: N/A
Cause:
Cause type:
Defect
Root Cause: VALID_DATE and VALID_TIME validate invalid input dates and times. Characters after the actual format are ignored e.g. "HH:MM;14:00ABC" and the value is set as being valid when it's not.
Resolution:
Update to a fix version listed below or a newer version if available.

Fix Status: Released

Fix Version(s):
Component(s): AE Server and Initialdata
Automation Engine 12.1.0 - Available
Automation Engine 12.0.3 - Available
Automation Engine 11.2.6 - Available
Additional Information:
Workaround :
N/A