Skip to content

Commit

Permalink
Merge pull request #5 from GEWIS/feature/formatter-utilities
Browse files Browse the repository at this point in the history
  • Loading branch information
BHenkemans authored Jul 24, 2023
2 parents 55f6f64 + cffc000 commit 71083c3
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/utils/formatterUtils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
export function formatDateTime(date: Date): string {

const daysOfWeek: Array<string> = [
"Sunday",
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
"Friday",
"Saturday"
]

const day = date.getDate().toString();
const monthIndex = date.getMonth().toString();
const year = date.getFullYear().toString();
const dayOfWeek = daysOfWeek[date.getDay()];
return `${day}-${monthIndex}-${year} (${dayOfWeek})`;
}

0 comments on commit 71083c3

Please sign in to comment.