Files
lara-bermite/resources/js/customPrototypes.ts
2023-10-01 23:19:08 +02:00

15 lines
350 B
TypeScript

const weekDays = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']
interface Date {
getWeekDay(): string,
toSQLDate(): string,
}
Date.prototype.toSQLDate = function (): string {
return (new Date(this)).toISOString().split('T')[0]
}
Date.prototype.getWeekDay = function () {
return weekDays[this.getDay()]
}