
Working on a renew book feature for Summa. Once the renewal process is successfully completed, I need to add one month to a Javascript timestamp to calculate the new return date for the material in question.
Easy… just do something like:
return new Date(timestamp).addMonth(1);
Well, no. Do:
var date = new Date(timestamp);
date.setMonth(date.getMonth() + 1);
Fair enough. But if the current month is December, the f… year doesn’t change when I add a month. I need to do a manual year update.
Summa is relying heavily on the Prototype javascript framework, but it sadly lacks any date related features. The same goes for jQuery, as far as I can see.
So javascript may be en vogue right now, but sometimes it’s a pain.
Tags: javascript, Summa