Skip to content

Instantly share code, notes, and snippets.

View timbillstrom's full-sized avatar

Tim Billström timbillstrom

View GitHub Profile
@timbillstrom
timbillstrom / getMondayAndFriday.js
Created August 6, 2020 16:05
Get the date for Monday and Friday of the current week, with JS.
function getMonday() {
d = new Date();
var day = d.getDay(),
diff = d.getDate() - day + (day == 0 ? -6 : 1);
return new Date(d.setDate(diff));
}
function getFriday() {
let monday = getMonday();
return new Date(monday.setDate(monday.getDate() + 4));
\_ヘ(◕‿◕✰)
\_ヘ(ω`*)
\(★^∀^★)/