Last active
September 10, 2020 08:08
-
-
Save robozavri/460439e4c4d1f922ac6781fdc7803884 to your computer and use it in GitHub Desktop.
#javascript date snippit get end of week
This file contains hidden or 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 endOfWeek(date) | |
{ | |
var lastday = date.getDate() - (date.getDay() - 1) + 6; | |
return new Date(date.setDate(lastday)); | |
} | |
$('#datetimepicker1').datetimepicker({ | |
format: 'dddd, MMMM Do YYYY, h a', | |
minDate: dateToday, | |
maxDate : endOfWeek(new Date()), | |
}); | |
************************************* source ****************************************************** | |
function endOfWeek(date) | |
{ | |
var lastday = date.getDate() - (date.getDay() - 1) + 6; | |
return new Date(date.setDate(lastday)); | |
} | |
dt = new Date(); | |
console.log(endOfWeek(dt).toString()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment