Title:
dateCompare() interprets supplied date value if set using dateConvert('local2Utc',now())
| View in TrackerStatus/Resolution/Reason: Closed/Withdrawn/AsDesigned
Reporter/Name(from Bugbase): Dave Cahill / Dave Cahill (web-eng)
Created: 08/10/2014
Components: Language
Versions: 10.0
Failure Type:
Found In Build/Fixed In Build: Final /
Priority/Frequency: Major / All users will encounter
Locale/System: English / Windows 7 64-bit
Vote Count: 0
Problem Description:
When supplying a dateTime value to dateCompare that is generated from dateConvert('local2Utc',now()), dateCompare uses the "now() value" instead of the "dateConverted value".
Steps to Reproduce:
<cfset date1 = dateConvert('local2Utc', now())>
<cfset date2 = createDateTime(2014,08,09,13,20,00)>
<cfoutput>
<p>Time of test = #Now()#</p>
<p>date1 = #date1#</p>
<p>date2 = #date2#</p>
<p>dateCompare(date1, date2 ) = #dateCompare(date1, date2 )#</p>
Actual Result:
Time of test = {ts '2014-08-09 14:18:42'}
date1 = {ts '2014-08-09 04:18:42'}
date2 = {ts '2014-08-09 13:20:00'}
dateCompare(date1, date2 ) = 1
Expected Result:
Time of test = {ts '2014-08-09 14:18:42'}
date1 = {ts '2014-08-09 04:18:42'}
date2 = {ts '2014-08-09 13:20:00'}
dateCompare(date1, date2 ) = -1
Any Workarounds:
When setting a UTC dateTime value for date1, don't use dateConvert, instead use dateAdd()
<cfset date1 = DateAdd("s", GetTimeZoneInfo().UTCTotalOffset, now())>
----------------------------- Additional Watson Details -----------------------------
Watson Bug ID: 3802931
External Customer Info:
External Company:
External Customer Name: web-eng
External Customer Email:
External Test Config: My Hardware and Environment details:
Running CF10 on local and remote shared hosting.
Attachments:
Comments: