mirror of
https://github.com/tomru/pfadi-bussle.git
synced 2026-03-04 06:57:12 +01:00
show booking date in mails
This commit is contained in:
@@ -3,6 +3,20 @@ import { parse, format, addDays } from 'date-fns'
|
||||
const FRONTEND_FORMAT = 'dd.MM.yyyy'
|
||||
const BACKEND_FORMAT = 'yyyy-MM-dd'
|
||||
|
||||
export function daysFormatFrontend(days: string[]) {
|
||||
if (days.length === 0) {
|
||||
return ''
|
||||
}
|
||||
|
||||
if (days.length === 1) {
|
||||
return dateFormatFrontend(new Date(days[0]))
|
||||
}
|
||||
|
||||
return [days[0], days.slice(-1)]
|
||||
.map((day: string) => dateFormatFrontend(new Date(day)))
|
||||
.join('-')
|
||||
}
|
||||
|
||||
export function getDays({
|
||||
startDate,
|
||||
endDate,
|
||||
|
||||
Reference in New Issue
Block a user