Argiris Deligiannidis 25883a5362 Finalized codebase
2024-04-14 20:33:51 +03:00

17 lines
592 B
JavaScript

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;