forked from MyHomeworkSpace/MyHomeworkSpace
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
31 lines (27 loc) · 696 Bytes
/
Copy pathutils.js
File metadata and controls
31 lines (27 loc) · 696 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var utils = {};
utils.findThisMonday = function() {
var today = new Date();
while (today.getDay() != 1) { // loop until a monday is found
today.setDate(today.getDate() - 1);
}
return today;
};
utils.findNextMonday = function() {
var today = new Date();
while (today.getDay() != 1) { // loop until a monday is found
today.setDate(today.getDate() + 1);
}
return today;
};
utils.formatDate_roux = function(dateObj) {
var month = (dateObj.getMonth() + 1).toString();
var date = dateObj.getDate().toString();
if (month.length == 1) {
month = "0" + month;
}
if (date.length == 1) {
date = "0" + date;
}
return dateObj.getFullYear() + month + date;
};
module.exports = utils;