Std.Date.ConvertDateFormatMultiple() returns odd values when given invalid date

Description

ConvertDateFormatMultiple() is actually two calls, with DateToString() consuming the output of MatchDateString(). The former is new code (as of the major additions to Std.Date in 5.0) while the latter is old code. The new code does not check the old code's return value, so it winds up trying to parsing '0' as a numeric date in YYYYMMDD format, leading to a strange returned result.

The fix is to validate the returned value of MatchDateString() and return an empty string if the date is invalid.

Conclusion

None

Activity

Show:

Dan Camper March 15, 2016 at 1:16 PM

Sample code illustrating failure:

import std; dt_formats := ['%m/%d/%Y', '%Y-%m-%d','%mm/%dd/%Y']; output(std.date.ConvertDateFormatMultiple('', dt_formats));

Return value is -11130 instead of empty string.

Fixed
Pinned fields
Click on the next to a field label to start pinning.

Details

Components

Assignee

Reporter

Priority

Fix versions

Created March 14, 2016 at 5:02 PM
Updated March 15, 2016 at 2:41 PM
Resolved March 15, 2016 at 2:41 PM

Flag notifications