local-weather/utils/functions/weekday.ts

6 lines
304 B
TypeScript
Raw Normal View History

2024-05-12 19:14:36 +00:00
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
}