Skip to content

Commit 0f7f955

Browse files
authored
Create javascript_dates.js
1 parent 1169475 commit 0f7f955

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
'use strict';
2+
3+
process.stdin.resume();
4+
process.stdin.setEncoding('utf-8');
5+
6+
let inputString = '';
7+
let currentLine = 0;
8+
9+
process.stdin.on('data', inputStdin => {
10+
inputString += inputStdin;
11+
});
12+
13+
process.stdin.on('end', _ => {
14+
inputString = inputString.trim().split('\n').map(string => {
15+
return string.trim();
16+
});
17+
18+
main();
19+
});
20+
21+
function readLine() {
22+
return inputString[currentLine++];
23+
}
24+
25+
// The days of the week are: "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
26+
function getDayName(dateString) {
27+
const date = new Date(dateString);
28+
29+
const options = {
30+
weekday: 'long'
31+
};
32+
33+
return new Intl.DateTimeFormat('en-Us', options).format(date);
34+
}
35+

0 commit comments

Comments
 (0)