Skip to content

Commit

Permalink
Add 'Free cancellation' translation and update cancellation text logic
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Jan 15, 2025
1 parent 16ad2bc commit 2218473
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2505,6 +2505,7 @@ const translations = {
carType: 'Car type',
cancellation: 'Cancellation policy',
cancellationUntil: 'Free cancellation until',
freeCancellation: 'Free cancellation',
confirmation: 'Confirmation number',
},
train: 'Rail',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2529,6 +2529,7 @@ const translations = {
carType: 'Tipo de coche',
cancellation: 'Política de cancelación',
cancellationUntil: 'Cancelación gratuita hasta el',
freeCancellation: 'Cancelación gratuita',
confirmation: 'Número de confirmación',
},
train: 'Tren',
Expand Down
12 changes: 9 additions & 3 deletions src/pages/Travel/CarTripDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ function CarTripDetails({reservation, personalDetails}: CarTripDetailsProps) {

const pickUpDate = DateUtils.getFormattedTransportDateAndHour(new Date(reservation.start.date));
const dropOffDate = DateUtils.getFormattedTransportDateAndHour(new Date(reservation.end.date));
const cancellationText = reservation.cancellationDeadline
? `${translate('travel.carDetails.cancellationUntil')} ${DateUtils.getFormattedTransportDateAndHour(new Date(reservation.cancellationDeadline)).date}`
: reservation.cancellationPolicy;

let cancellationText = reservation.cancellationPolicy;
if (reservation.cancellationDeadline) {
cancellationText = `${translate('travel.carDetails.cancellationUntil')} ${DateUtils.getFormattedTransportDateAndHour(new Date(reservation.cancellationDeadline)).date}`;
}

if (reservation.cancellationPolicy === null && reservation.cancellationDeadline === null) {
cancellationText = translate('travel.carDetails.freeCancellation');
}

const displayName = personalDetails?.displayName ?? reservation.travelerPersonalInfo?.name;

Expand Down

0 comments on commit 2218473

Please sign in to comment.