-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdate.js
45 lines (38 loc) · 1.02 KB
/
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
43
44
//jshint esversion:6
exports.getDate= function(){
const today = new Date();
// var currentDay = today.getDay();
// var day = "";
const options = { weekday: 'long',
month: 'long',
day: 'numeric' };
return today.toLocaleDateString("en-US", options)};
// switch(currentDay){
// case 0:
// day = "Sunday";
// break;
// case 1:
// day = "Monday";
// break;
// case 2:
// day = "Tuesday";
// break;
// case 3:
// day = "Wednesday";
// break;
// case 4:
// day = "Thursday";
// break;
// case 5:
// day = "Friday";
// break;
// case 6:
// day = "Saturday";
// break;
// default:
// console.log("Error: current day is equal to:" + currentDay)
exports.getDay= function(){
const today = new Date();
const options = { weekday: 'long' };
return today.toLocaleDateString("en-US", options)
}