-
Notifications
You must be signed in to change notification settings - Fork 0
/
date.js
28 lines (25 loc) · 788 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
// exporting this function so we can use it as a module
// after importing it in the main file
// module.exports = getDate
// then we call in the main file just date() - or a better solution
// to be more specific
// or if we want to specify more functions (module.exports = exports)
exports.getDate = () => {
// getting the day in specific form
const today = new Date();
const options = {
weekday: 'long',
day: 'numeric',
month: 'long',
};
return today.toLocaleDateString("en-US", options);
};
// exporting the next function
exports.getDay = () => {
// getting the day in specific form
const today = new Date();
const options = {
weekday: 'long',
};
return today.toLocaleDateString("en-US", options);
};