Created
July 25, 2015 11:13
-
-
Save ihorkatkov/6cdbd49f5901fb70be9a to your computer and use it in GitHub Desktop.
[JS] getDateAgo(date, days) - возвращает число, которое было days дней назад от даты date.
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
function getDateAgo(date, days) { | |
var newDate = new Date(date); | |
newDate.setDate(newDate.getDate() - days) | |
return newDate.getDate(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment