This commit is contained in:
TheNetsky
2023-09-25 12:16:40 +02:00
parent 0a675dd6e0
commit c802492f18
27 changed files with 2115 additions and 1 deletions

22
src/util/Utils.ts Normal file
View File

@@ -0,0 +1,22 @@
export async function wait(ms: number): Promise<void> {
return new Promise<void>((resolve) => {
setTimeout(resolve, ms)
})
}
export function getFormattedDate(ms = Date.now()) {
const today = new Date(ms)
const month = String(today.getMonth() + 1).padStart(2, '0') // January is 0
const day = String(today.getDate()).padStart(2, '0')
const year = today.getFullYear()
return `${month}/${day}/${year}`
}
export function shuffleArray(array: string[]): string[] {
const shuffledArray = array.slice()
shuffledArray.sort(() => Math.random() - 0.5)
return shuffledArray
}