Last active
June 17, 2017 22:36
-
-
Save BrianMehrman/c15300c2aaffdafe4fe4c2b1997d3c47 to your computer and use it in GitHub Desktop.
Code to alter date quickly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const daysAgo = ((days, date) => { let d = date || new Date(); d.setDate(d.getDate() - (days || 1)); return d; }); | |
const hoursAgo = ((hours, date) => { let d = date || new Date(); d.setHours(d.getHours() - (hours || 1)); return d; }); | |
const mintuesAgo = ((mins, date) => { let d = date || new Date(); d.setMinutes(d.getMinutes() - (mins || 1)); return d; }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment