Date.compare doesn't work same as dateCompare| View in Tracker
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: ? / 303808
Priority/Frequency: Normal / Some users will encounter
Locale/System: / Platforms All
Vote Count: 1
Repro: https://trycf.com/gist/623f7c8bfb40420461c578b7255c5932/acf2016?theme=monokai <cfscript> nowAsDateObject = now(); nowAsString = toString(now()); dateFromParsedString = parseDateTime(nowAsString); writeDump([ nowAsDateObject.compare(dateFromParsedString), nowAsDateObject.compare(dateFromParsedString, "s"), dateCompare(nowAsDateObject, dateFromParsedString, "s") ]); </cfscript> Results: array 1 1 2 0 3 0 The first one is wrong in two ways: 1) it should behave the same as when specifying "s", as "s" is the default 2) the dates are the same: there *isn't* a difference. I suspect the comparison is doing a comparison to an unsolicited level of accuracy, and this reflects a bug in how dates are converted to strings as it looks like there's a millisecond component lost. But that's a different issue, possibly. The dates *should* be the same, anyhow.