Worth pointing out that this function takes a -full date- as an argument.
You'd think (maybe) that you could just pass a month value, but February screws that up every 4 years... much like the American voting population electing a new president (but I digress...)
Might seem obvious, but I've seen a lot of posts on mailing lists and forums where people get unexpected results due to passing in only a month value :)
Really you'd think they would have taken care of the leap year given that there is a isLeapYear function. I'll change the date on my server see what I come up with.
Worth pointing out that this function takes a -full date- as an argument.
ReplyDeleteYou'd think (maybe) that you could just pass a month value, but February screws that up every 4 years... much like the American voting population electing a new president (but I digress...)
Might seem obvious, but I've seen a lot of posts on mailing lists and forums where people get unexpected results due to passing in only a month value :)
Really you'd think they would have taken care of the leap year given that there is a isLeapYear function. I'll change the date on my server see what I come up with.
ReplyDeletehttp://cfquickdocs.com/#IsLeapYear
Well I get 29 days when I do get daysInMonth() for a leap year and 28 when its not so perhaps they fixed the issue in CF8 and CF9.
ReplyDeleteNo no no... your initial example was/is spot on. You're passing now(), which is a full date value.
ReplyDeleteI was just trying to prepare people who might come away from the entry and try something like daysInMonth(n), where n is a value between 1 and 12.
Can't just pass a month value is all I was trying to say :)
Ahh OK. Thanks for clearing that up Charlie. Now that I re-read your comment I see what you meant.
ReplyDelete