Jacek
1
Hello!
I’ve just run into an issue with isDate(). Strange strings are interpreted
as valid dates. Please consider the following examples:
isDate(“32896-0002”);
Lucee 4.5.4.017 final : true
ACF 11: false
parseDateTime(“32896-0002”);
Lucee 4.5.4.017 final : {ts ‘32896-02-01 00:00:00’}
ACF 11 : 32896-0002 is an invalid date or time string
Is this an expected behavior in Lucee 4.5? I just preferred to ask here
first, before posting a bug.
Thanks!
Jacek
3
I’ll report a bug then.On Friday, January 27, 2017 at 12:59:40 AM UTC-3, Jacek wrote:
Hello!
I’ve just run into an issue with isDate(). Strange strings are interpreted
as valid dates. Please consider the following examples:
isDate(“32896-0002”);
Lucee 4.5.4.017 final : true
ACF 11: false
parseDateTime(“32896-0002”);
Lucee 4.5.4.017 final : {ts ‘32896-02-01 00:00:00’}
ACF 11 : 32896-0002 is an invalid date or time string
Is this an expected behavior in Lucee 4.5? I just preferred to ask here
first, before posting a bug.
Thanks!
Jacek
4
Done. [LDEV-1185] - Lucee Tuesday, February 7, 2017 at 12:57:54 PM UTC-3, Jacek wrote:
I’ll report a bug then.
On Friday, January 27, 2017 at 12:59:40 AM UTC-3, Jacek wrote:
Hello!
I’ve just run into an issue with isDate(). Strange strings are
interpreted as valid dates. Please consider the following examples:
isDate(“32896-0002”);
Lucee 4.5.4.017 final : true
ACF 11: false
parseDateTime(“32896-0002”);
Lucee 4.5.4.017 final : {ts ‘32896-02-01 00:00:00’}
ACF 11 : 32896-0002 is an invalid date or time string
Is this an expected behavior in Lucee 4.5? I just preferred to ask here
first, before posting a bug.
Thanks!
harryf
5
Same issue here, testing finds ACF 11: valid, Lucee 5.3.7.47: invalid:—
<cfscript>
writedump(isValid('date','Friday, 23 April 2021'));
</cfscript>
Mind blowing. Investigating if it’s a LS/locale issue or is something more general.
UPDATE: For now, I’ve put together a workaround that others might find useful:
<cffunction name="isValidDateWithjQueryStyle" output="no">
<!---
Lucee and ACF dates validate differently:
https://www.lucee.nl/post.cfm/the-horror-of-isdate-in-coldfusion-and-lucee
http://www.neiland.net/blog/article/be-careful-with-coldfusion-date-validation/
https://lucee.daemonite.io/t/isdate-unexpected-behavior/1417/5?u=harryf
--->
<cfargument name="supposedDate" required="true">
<cfif isValid('date',ARGUMENTS.supposedDate)>
<cfreturn true>
<cfelseif datePatternMatch(ARGUMENTS.supposedDate, "dddd, d mmmm yyyy")>
<cfreturn true>
<cfelse>
<cfreturn false>
</cfif>
</cffunction> <!--- END isValidDateWithjQueryStyle --->
Uses this:—
https://cflib.org/udf/datePatternMatch
Please always state the exact Lucee version.
IsDate is horrible due to cfml, compatibility history.
When ever possible, always parse dates with a known mask, otherwise it’s pot luck
1 Like