Kinky Calendar Leap Year Update

Posted March 4, 2008 at 3:37 PM

Tags: ColdFusion

Just a quick update - Peter Bell pointed out to me that my ColdFusion Kinky Calendar system was breaking on my site. I took a quick look, and indeed it was. Oh No! So, I threw on my ColdFusion ninja suit and jumped into action. The problem was a little mysterious to debug, but I finally narrowed it down to a leap year problem. The leap year itself was not causing the problem; the problem was that I had some code that looked like this:

  • CreateDate(
  • (Year( start_date ) - 1),
  • Month( start_date ),
  • Day( start_date )
  • )

The problem here is that on February 29th of this year, the above code tried to create the 29th of last year. Of course, there was no February 29th of last year. This was an easy fix with some conditional logic.

Thanks Peter for bringing that to my attention. I have updated the Kinky Calendar project page with a new ZIP download.



Reader Comments

Mar 4, 2008 at 4:06 PM // reply »
18 Comments

Can you tell us which file (line numbers) were changed so we can update our copies?


Mar 4, 2008 at 4:55 PM // reply »
39 Comments

Why not use DateAdd("yyyy",-1,start_date) ?


Mar 5, 2008 at 4:14 AM // reply »
2 Comments

Thanks! Sometimes February has only 28 days :-)


Mar 6, 2008 at 8:57 AM // reply »
8,836 Comments

@Sami,

It was the _functions.cfm file. It was several different lines for the month repeat and the year repeat. It's probably just easiest to download the ZIP and replace that function. Or, if you just want to swap out those case statements:

<!--- Repeat monthly. --->
<cfcase value="4">

and

<!--- Repeat yearly. --->
<cfcase value="5">

@Steve,

Hmmm, not sure. I think you might be on to something :) I love when I overlook the most obvious solution! Thanks Steve.


Mar 6, 2008 at 10:10 AM // reply »
8,836 Comments

@Steve,

Thanks for the tip. I updated the code with your DateAdd() suggestion. Seems to work like a charm.


May 23, 2008 at 7:38 PM // reply »
1 Comments

Thanks for the information ....


Aug 2, 2008 at 10:51 PM // reply »
1 Comments

I have not gotten this thing to work AT ALL.

There is a request variable somewhere that keeps giving me an error

Please post a working copy without the request.dsn.username VARIABLES!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


Aug 4, 2008 at 8:35 AM // reply »
8,836 Comments

I cannot post a version without that or none of it would work. I use that variable to pull data out of the database.


Post A Comment

Comment Etiquette: Please do not post spam. Please keep the comments on-topic. Please do not post unrelated questions or large chunks of code. And, above all, please be nice to each other - we're trying to have a good conversation here.

Please review the following issues:

Author Name:


Author Email:

Author Website:

Comment:

Formatting: <strong>bold</strong> <em>italic<em>







  • Help Wanted - Find Your Next ColdFusion Job
Recent Blog Comments
Sep 9, 2010 at 12:50 AM
New ColdFusion Error: Form Entries Incomplete Or Invalid
Once again you save my day Ben. Just migrated from Railo to CF9 and that error was everywhere, I was on the verge of tears... ... read »
Sep 8, 2010 at 7:28 PM
What ColdFusion Teaches Us About The Ultimate "Roll Your Own" Solution
This is how good enterprise software and good enterprise architecture is built. In addition to the time factor and the abstraction potential, the most compelling reason I've ever found to incorporate ... read »
Sep 8, 2010 at 4:47 PM
Ask Ben: Reading In A File Using CFFile And CFInclude
@Ben, Thanks for the quick reply. That was the idea. The getFileFromPath returns a "52648.tmp" file name which is generated by the server not the actual file name. I'm not sure how to extract t ... read »
Sep 8, 2010 at 4:10 PM
Strange ColdFusion URLDecode() and GetEncoding() Behavior
Yep - too strange since the second arg in urldecode is optional. I did run across the error and googled it and landed safely here. Thanks, Ben! ... read »
Sep 8, 2010 at 3:33 PM
What ColdFusion Teaches Us About The Ultimate "Roll Your Own" Solution
@Steve, @Darren, Excellent point! Keeping a platform API (any API at that matter) allows for a much easier time to swap underlying libraries, or even to build your own. @Rick, @Jacob, @JC, I thin ... read »
JC
Sep 8, 2010 at 2:02 PM
What ColdFusion Teaches Us About The Ultimate "Roll Your Own" Solution
@Jacob -- absolutely. The trick is knowing when it'll take less time to do it yourself than wedge someone else's oval shaped application into your round hole. ... read »
Sep 8, 2010 at 1:49 PM
What ColdFusion Teaches Us About The Ultimate "Roll Your Own" Solution
@Rick, I hope this isn't too off topic but, is this true? I've only been programming in the workplace for 4 years. I often look at what others have done and adapt it to my particular needs. Often t ... read »
Sep 8, 2010 at 12:39 PM
ColdFusion CFMailParam's New "Content" Attribute Is Awesome
Ben, Mine is version 8 and tried to download the update but still did not recognized content attribute in cfmailparam. May be I installed a wrong update, so many of them not sure which one I need wit ... read »