6 lines
304 B
TypeScript
6 lines
304 B
TypeScript
|
export default function weekday(date: string): string {
|
||
|
const newDate = new Date(date);
|
||
|
const dayNumber = newDate.getDay();
|
||
|
const weekdays = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'];
|
||
|
return weekdays[dayNumber]; // Directly return the weekday string
|
||
|
}
|