Who does one talk to about documentation of the `i...
# adobe
b
Who does one talk to about documentation of the
isLeapYear
method? I'm seeing some interesting inconsistencies.
For example, if I click the "Try in CFFiddle" link and run the example as is, it's fine. If I change the year from 2016 to 2024, CF reports that this is not a leap year.
Further, the method signature above suggests that we should be passing a number, so why the examples are passing a date to the method is also dubious, IMO.
Here's the fiddle where I only changed 2016 to 2024: https://cffiddle.org/app/file?filepath=ab4e9ac5-a07d-43c2-bb51-632cbb03f476/1896cb4[…]bd4-ad3c-300e46516b01/9880b855-b896-4112-ab63-fc7cc1467959.cfm. It is falsely being reported as not a leap year.
p
So I noticed that in your fiddle, the first call to
IsLeapYear()
is receiving the whole date object rather than just the year. If I change that to just pass-in the year, then it works.
c
@bockensm I think the examples are poorly written. The docs state that the function signature is
isLeapYear( year )
, not
isLeapYear( date )
. If you pass in just the year (2024), it returns YES.
b
Right, that's what I'm complaining about. The docs above say to pass a number, but the example passes a date object. That needs to be fixed.
But, secondarily, why does the given example pass, but when I change only the year to this year, it then fails?
p
Ah, I see, yeah the CFDocs shows a date: https://cfdocs.org/isleapyear
c
Can you put a post in the #documentation channel and tag @saghosh? That way Adobe can fix their docs.
b
@Panman82 I submitted a PR to fix the cfdocs example
👍 1
@cfvonner will do, thanks.
c
> But, secondarily, why does the given example pass, but when I change only the year to this year, it then fails? I think CF might be coercing the date back to a number, and the number happens to be a valid leap year sometimes.
p
Does the documentation channel communicate with Adobe too? I think the reason Mark is posting here is that the Adobe docs are wrong too: https://helpx.adobe.com/coldfusion/cfml-reference/coldfusion-functions/functions-in-k/isleapyear.html
Ah, never mind, just look there and see saghosh must be an adobe person.
s
Thanks @Panman82
p
Not me, Mark (bockensm) reported this one.