Skip to content

Commit

Permalink
show paranthesis only when both short and long name are present
Browse files Browse the repository at this point in the history
  • Loading branch information
rushatgabhane committed May 30, 2024
1 parent e5a6960 commit a6fc886
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/ReportActionItem/TripDetailsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,15 @@ function ReservationView({reservation}: ReservationViewProps) {

const reservationIcon = TripReservationUtils.getTripReservationIcon(reservation.type);

const formatAirportInfo = (reservationTimeDetails: ReservationTimeDetails) =>
`${reservationTimeDetails?.longName ? `${reservationTimeDetails?.longName} ` : ''}${reservationTimeDetails?.shortName}`;
const formatAirportInfo = (reservationTimeDetails: ReservationTimeDetails) => {
const longName = reservationTimeDetails?.longName ? `${reservationTimeDetails?.longName} ` : '';
let shortName = reservationTimeDetails?.shortName ? `${reservationTimeDetails?.shortName}` : '';

shortName = longName && shortName ? `(${shortName})` : shortName;

return `${longName}${shortName}`;
};

const getFormattedDate = () => {
switch (reservation.type) {
case CONST.RESERVATION_TYPE.FLIGHT:
Expand Down

0 comments on commit a6fc886

Please sign in to comment.