JavaScript Date Add

1 post

Add days, months and years in JavaScript

This JavaScript function has been updated to better handle various scenarios, please check the new version here: https://learningpenguin.net/2017/07/20/add-days-months-years-date-javascript/ In ASP.NET, you can easily use DateTime.AddDays(), DateTime.AddMonths(), or DateTime.AddyYears() function to get a new DateTime object, but in JavaScript, there is no such built-in function. Since it is very common you have to do some date calculation or validation in JavaScript, I decided to write my own JavaScript function to add days, months, and years to a […]