Status/Resolution/Reason: Closed/Withdrawn/Workaround
Reporter/Name(from Bugbase): Matt Davis / Matt Davis ()
Created: 12/29/2017
Components: Language, Functions
Versions: 2016,11.0
Failure Type: Incorrectly functioning
Found In Build/Fixed In Build: Coldfusion 10 (Update 23) & Coldfusion 2016 (Update 5) (likey in 11 but do not have) /
Priority/Frequency: Normal / All users will encounter
Locale/System: English / Win 2016
Vote Count: 1
Problem Description: when running a loop using a timespan in the step attribute sometime the loop does not stop at the proper endpoint (TO attribute)
A version of the code came from URL:
https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-tags/tags-j-l/cfloop-looping-over-a-date-or-time-range.html
Steps to Reproduce:
<cfoutput>
<cfset startTime = CreateTime(10,0,0)>
<cfset endTime = CreateTime(15,0,0)>
startTime=#startTime#<br>
endTime=#endTime#<br>
step=#CreateTimeSpan(0,0,15,0)# (every fifteen minutes)<br>
<cfloop from="#startTime#" to="#endTime#" index="i" step="#CreateTimeSpan(0,0,15,0)#">
#TimeFormat(i, "hh:mm:ss tt")#<BR>
</cfloop>
<HR></HR>
<cfset dtStart = "10:00 AM" />
<cfset dtEnd = "3:00 PM" />
dtStart=#dtStart#<br>
dtEnd=#dtEnd#<br>
step=#(1/24)# (every hour)<br>
<cfloop
index="dtHour"
from="#dtStart#"
to="#dtEnd#"
step="#(1/24)#">
#TimeFormat( dtHour, "h:mm TT" )#<br />
</cfloop>
</cfoutput>
Actual Result:
startTime={ts '1899-12-30 10:00:00'}
endTime={ts '1899-12-30 15:00:00'}
step=0.0104166666667 (every fifteen minutes)
10:00:00 AM
10:15:00 AM
10:30:00 AM
10:45:00 AM
11:00:00 AM
11:15:00 AM
11:30:00 AM
11:45:00 AM
12:00:00 PM
12:15:00 PM
12:30:00 PM
12:45:00 PM
01:00:00 PM
01:15:00 PM
01:30:00 PM
01:45:00 PM
02:00:00 PM
02:15:00 PM
02:30:00 PM
02:45:00 PM
dtStart=10:00 AM
dtEnd=3:00 PM
step=0.0416666666667 (every hour)
10:00 AM
11:00 AM
12:00 PM
1:00 PM
2:00 PM
Expected Result:
startTime={ts '1899-12-30 10:00:00'}
endTime={ts '1899-12-30 15:00:00'}
step=0.0104166666667 (every fifteen minutes)
10:00:00 AM
10:15:00 AM
10:30:00 AM
10:45:00 AM
11:00:00 AM
11:15:00 AM
11:30:00 AM
11:45:00 AM
12:00:00 PM
12:15:00 PM
12:30:00 PM
12:45:00 PM
01:00:00 PM
01:15:00 PM
01:30:00 PM
01:45:00 PM
02:00:00 PM
02:15:00 PM
02:30:00 PM
02:45:00 PM
03:00:00 PM
dtStart=10:00 AM
dtEnd=3:00 PM
step=0.0416666666667 (every hour)
10:00 AM
11:00 AM
12:00 PM
1:00 PM
2:00 PM
3:00 PM
Any Workarounds:
Attachments:
Comments: