show booking date in mails

This commit is contained in:
Thomas Ruoff
2020-11-07 00:38:29 +01:00
parent c223b05011
commit eeb8beba0a
3 changed files with 36 additions and 3 deletions

View File

@@ -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,