Java f#!*….. script


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.

This entry was posted in Summa and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s