Files
lara-bermite/resources/js/customPrototypes.ts
2024-03-06 09:42:12 +01:00

16 lines
412 B
TypeScript

const weekDays = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi']
// eslint-disable-next-line @typescript-eslint/no-unused-vars
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()]
}