Date evaluation not working correctly

Description

Date evaluation is not working correctly look at the following code snippet and the attached screenshot of the resulting dump.

Lucee is correctly reporting that 12-31-2015 is AFTER 12-30-2015 but is incorrectly reporting that 01-01-2016 is BEFORE 12-30-2015

arguments.startDateTime = '12/30/2015';
arguments.endDateTime = '12/31/2015';
writeOutput("startDateTime = #startDateTime# & endDateTime = #endDateTime#");
writeDump(isDate(arguments.startDateTime));
writeDump(isDate(arguments.endDateTime));
writeDump(arguments.startDateTime);
writeDump(arguments.endDateTime);
writeDump(arguments.startDateTime > arguments.endDateTime);
writeDump(dateTimeFormat(arguments.startDateTime));
writeDump(dateTimeFormat(arguments.endDateTime));
writeDump(dateTimeFormat(arguments.startDateTime) > dateTimeFormat(arguments.endDateTime));
writeDump(dateCompare(dateTimeFormat(arguments.startDateTime),dateTimeFormat(arguments.endDateTime),'d'));
writeOutput("<hr>");
arguments.endDateTime = '1/1/2016';
writeOutput("startDateTime = #startDateTime# & endDateTime = #endDateTime#");
writeDump(isDate(arguments.startDateTime));
writeDump(isDate(arguments.endDateTime));
writeDump(arguments.startDateTime);
writeDump(arguments.endDateTime);
writeDump(arguments.startDateTime > arguments.endDateTime);
writeDump(dateTimeFormat(arguments.startDateTime));
writeDump(dateTimeFormat(arguments.endDateTime));
writeDump(dateTimeFormat(arguments.startDateTime) > dateTimeFormat(arguments.endDateTime));
writeDump(dateCompare(dateTimeFormat(arguments.startDateTime),dateTimeFormat(arguments.endDateTime),'d'));

Environment

Windows server 2008, IIS7

Attachments

1

Activity

Michael Offner 
9 May 2016 at 12:53

sure you can do a feature request for a flag like this, but we have to make sure that lucee does not need to check that flag for every string comparsion.

Brad Wood 
5 May 2016 at 06:44

Ouch, just got bit by this while converting a large codebase from Adobe CF to Lucee for a client. Even if there is a performance hit, a flag to enable this would be nice to get legacy code bases up and running. Finding every instance of date strings being compared across a large code base is not easy.

Michael Offner 
18 February 2016 at 13:38
(edited)

this is a known difference between ACF and Lucee, see this ticket for details:
https://issues.jboss.org/browse/RAILO-1605

Please have in mind that the return value from dateTimeFormat is also a string. best is to make sure that when comparing dates, that at least one operator is a date object, otherwe you make a string comparison.

Michael Offner 
18 February 2016 at 13:24

simplified version of the test case:

Fixed

Details

Assignee

Reporter

Priority

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Affects versions

Created 12 November 2015 at 23:33
Updated 9 May 2016 at 12:53
Resolved 18 February 2016 at 13:38