tracker issue : CF-4198662

select a category, or use search below
(searches all categories and all time range)

Date.diff method doesn't work correctly

| View in Tracker

Status/Resolution/Reason: Closed/Withdrawn/AsDesigned

Reporter/Name(from Bugbase): Adam Cameron / Adam Cameron ()

Created: 05/12/2017

Components: Language, Member Functions

Versions: 2016,11.0,2018

Failure Type: Incorrectly functioning

Found In Build/Fixed In Build: ? /

Priority/Frequency: Normal / Some users will encounter

Locale/System: / Platforms All

Vote Count: 0

d1 = now();
d2 = now();

writeOutput(dateDiff("s", d1, d2));
writeOutput(d1.diff("s",  d2));



Looks to me like diff() is using the dates around the wrong way.

Nort really sure how this could have got through testing, TBH?



I note the status of this was just changed to "as designed". I now await with eager anticipation the explanation of this "design".
Comment by Adam C.
741 | July 25, 2017 11:55:03 AM GMT
There is difference in dateDiff(datepart, date1, date2) and date1.diff(datepart, date2). dateDiff(datepart, date1, date2) ==> date2 - date1 date1.diff(datepart, date2) ===> date1 - date2 We are doing proper documentation for this difference and that will be available soon.
Comment by Ajay R.
29797 | October 17, 2018 11:32:46 AM GMT
We have updated our doc --> []
Comment by Dattanand M.
29824 | October 23, 2018 07:12:42 AM GMT