/ Published in: JavaScript
date object return date of next month if day parameter overflows
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var month = {LastDay : function(Year,Month){ return 32 - new Date(Year,Month,32).getDate();}} var Year = {IsLeap: function(Year){ return 29 == month.LastDay(Year,1)}}; Year.IsLeap(2000); // returns true Year.IsLeap(2000); // returns false