-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
48 lines (41 loc) · 1.1 KB
/
script.js
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
document.querySelector("button").addEventListener("click", function () {
html2canvas(document.querySelector(".wrapper"), {
onrendered: function (canvas) {
// document.body.appendChild(canvas);
return Canvas2Image.saveAsPNG(canvas);
},
});
});
let today = new Date();
let dd = String(today.getDate()).padStart(2, "0");
let mm = String(today.getMonth() + 1).padStart(2, "0"); //January is 0!
let yyyy = today.getFullYear();
today = mm + "/" + dd + "/" + yyyy;
const month = [
"January",
"February",
"March",
"April",
"May",
"June",
"July",
"August",
"September",
"October",
"November",
"December",
];
// let time =
// today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
//in the sense of using a 24hr clock
let hours = new Date().getHours();
let min = new Date().getMinutes();
if (11.5 > 11) {
console.log("it is PM");
} else {
console.log("it is AM");
}
const d = new Date();
let name = month[d.getMonth()];
document.getElementById("header_month").innerHTML = `Current Month: ${name}`;
document.getElementById("header_date").innerHTML = ` ${today}`;