Skip to content

Instantly share code, notes, and snippets.

@ryumada
Last active October 25, 2021 02:45
Show Gist options
  • Save ryumada/f38779a22223882f0f0c0fc28c755b6c to your computer and use it in GitHub Desktop.
Save ryumada/f38779a22223882f0f0c0fc28c755b6c to your computer and use it in GitHub Desktop.
get daterange one month javascript
const getDaterangeOneMonth = () => {
let date = new Date();
let dateLater = new Date();
dateLater.setDate(date.getDate() + 30);
return `${date.toISOString().split("T")[0]} - ${dateLater.toISOString().split("T")[0]}`;
}
console.log(getDaterangeOneMonth); // 2021-10-25 - 2021-11-24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment