-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate.js
43 lines (30 loc) · 783 Bytes
/
date.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
module.exports.getDate = getDate;
function getDate(){
var today = new Date();
var option = {
weekday: 'long',
day: 'numeric',
month: 'long'
}
var day = today.toLocaleDateString('en-US', option);
return day;
}
// this can also be written as following(in a more succinct format):
// module.exports.getDate = function{
// var today = new Date();
// var option = {
// weekday: 'long',
// day: 'numeric',
// month: 'long'
// }
// return today.toLocaleDateString('en-US', option);
// }
module.exports.getDay= getDay;
function getDay(){
var today = new Date();
var option = {
weekday: 'long'
}
var day = today.toLocaleDateString('en-US', option);
return day;
}