title: How do i add years, months, days, hours, minutes or seconds to JavaScript Date object?
body: <p>I often encountered the situation where I want to add years, months, days, hours, minutes or seconds to a Date object in JavaScript. There are many ways described for each <em>specific</em> "add" (edit: as in add day for example) but I didn't find a complete solution on stackoverflow yet, so I decided to share my approach in <a href="https://stackoverflow.blog/2011/07/01/its-ok-to-ask-and-answer-your-own-questions/">Q&amp;A</a> style. <a href="https://stackoverflow.com/a/53338200/2556142">My own answer</a> is a way to deal with the problem without using a framework.</p>
  
  <hr>
  
  <p><em>Other solutions to the Problem suggested in comments and answers:</em></p>
  
  <p><strong>Frameworks/Libraries dealing with the problem:</strong></p>
  
  <p><a href="https://momentjs.com/docs/#/parsing/date/" rel="nofollow noreferrer">moment.js</a> (thanks JonnyIrving/Eugene Mihaylin/Pac0)</p>
  
  <p><a href="https://blog.bitsrc.io/9-javascript-date-time-libraries-for-2018-12d82f37872d" rel="nofollow noreferrer">https://blog.bitsrc.io/9-javascript-date-time-libraries-for-2018-12d82f37872d</a> (thanks RobG)</p>
  
  <p><a href="https://github.com/taylorhakes/fecha" rel="nofollow noreferrer">fecha.js</a> (thanks RobG)</p>
  
  <p><strong>Examples of specific add topics</strong> (thanks Pac0):</p>
  
  <p>Days: <a href="https://stackoverflow.com/questions/563406/add-days-to-javascript-date">Add days to JavaScript Date</a></p>
  
  <p>Minutes: <a href="https://stackoverflow.com/questions/1197928/how-to-add-30-minutes-to-a-javascript-date-object">How to add 30 minutes to a JavaScript Date object?</a></p>
  
  <p>Hours: <a href="https://stackoverflow.com/questions/1050720/adding-hours-to-javascript-date-object">Adding hours to Javascript Date object?</a></p>
  
  <p>Months: <a href="https://stackoverflow.com/questions/2706125/javascript-function-to-add-x-months-to-a-date/2706169">JavaScript function to add X months to a date</a></p>
  
  <hr>
  
  <p><em>(I will not mark any answer as accepted because in my opinion there are multiple valid ways)</em></p>