Status/Resolution/Reason: Closed/Fixed/
Reporter/Name(from Bugbase): danny armstrong / danny armstrong (danny armstrong)
Created: 01/30/2014
Components: Language
Versions: 9.0.1
Failure Type:
Found In Build/Fixed In Build: 9.0.1 /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Linux All
Vote Count: 2
Problem Description:
Sometimes when two dates are compared the result is not what is expected. Here is example code that shows for most days of the year the difference is 32 months. For four days a year the result is 31.
Steps to Reproduce:
Run this code:
<cfloop
from = "01/01/2000"
to = "01/01/2018"
index = "date"
step = "1">
<cfset datePlus32 = dateAdd('m', 32, date)/>
<cfset monsDiff = dateDiff("m", date, datePlus32)/>
<cfoutput>#datePlus32#, #monsDiff#, #IIF(monsDiff EQ 31, DE("<a style='color: red;'>!!</a>"), DE(""))#<br/></cfoutput>
</cfloop>
Actual Result:
Most days report 32 month difference but 4 times a year the result is 31.
Expected Result:
I expect 32 to be the result every time. Instead 4 times a year the result is 31.
Any Workarounds:
Use database to do date math :(
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3701665
External Customer Info:
External Company:
External Customer Name: detarmstrong
External Customer Email:
External Test Config: My Hardware and Environment details:
coldfusion 9.0.1, update level /opt/coldfusion9/lib/updates/hf901-00010.jar
ubuntu 12.04 64bit
apache 2.2.22
Also confirmed on trycf.com.
Attachments:
Comments: