Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to get 6 months after date object

const getDaysInMonth = (year, month) => new Date(year, month, 0).getDate()

const addMonths = (input, months) => {
  const date = new Date(input)
  date.setDate(1)
  date.setMonth(date.getMonth() + months)
  date.setDate(Math.min(input.getDate(), getDaysInMonth(date.getFullYear(), date.getMonth()+1)))
  return date
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery datepicker enable year selection 
Javascript :: 9 + 10 
Javascript :: response intersepters for axios create 
Javascript :: jquery elements which id doesnt contain string 
Javascript :: how to add key value pair in object 
Javascript :: js run npm 
Javascript :: jquery select 
Javascript :: in compare method why we taking a and b for sorting in javascript 
Javascript :: how to stop overlapping divs to interact with each others click events 
Javascript :: bubbling and capturing in javascript 
Javascript :: remove duplicates in json in flutter 
Javascript :: react js and graphql integration 
Javascript :: indexof js 
Javascript :: Iterating set object javascript 
Javascript :: js ?. 
Javascript :: vue add watcher 
Javascript :: vuejs get data fromo ajax 
Javascript :: array map order by timestamp reactjs 
Javascript :: spam system discord.js 
Javascript :: uuid react native expo 
Javascript :: angular two datepickers 
Javascript :: what is an arrow function and how is it used in react 
Javascript :: updatig state in react 
Javascript :: custom event example 
Javascript :: material-ui.com autocomplete grouped 
Javascript :: react-native-apple-authentication 
Javascript :: css using inline styles 
Javascript :: react link vs navlink 
Javascript :: css javascript 
Javascript :: node js how to basic auth to specific urk 
ADD CONTENT
Topic
Content
Source link
Name
5+9 =