16 lines
410 B
TypeScript
16 lines
410 B
TypeScript
const weekDays = ['lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi', 'dimanche']
|
|
|
|
interface Date {
|
|
getWeekDay(): string,
|
|
toSQLDate(): string,
|
|
}
|
|
|
|
Date.prototype.toSQLDate = function (): string {
|
|
return (new Date(this)).toISOString().split('T')[0]
|
|
}
|
|
|
|
Date.prototype.getWeekDay = function () {
|
|
const dayIndex = this.getDay() === 0 ? 6 : this.getDay() - 1
|
|
return weekDays[dayIndex]
|
|
}
|