Finalized codebase
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
const utils = {
|
||||
/**
|
||||
* A function that takes a date in the format 'dd/mm/yyyy' and returns the day of the week as a string.
|
||||
*
|
||||
* @param {string} date - The input date in the format 'dd/mm/yyyy'
|
||||
* @return {string} The day of the week
|
||||
*/
|
||||
getDay(date) {
|
||||
let isoDate = date.split('/');
|
||||
date = isoDate[2] + '-' + isoDate[1] + '-' + isoDate[0];
|
||||
const names = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||||
const day = new Date(date).getDay();
|
||||
return names[day];
|
||||
},
|
||||
};
|
||||
export default utils;
|
||||
Reference in New Issue
Block a user