diff --git a/controllers/flight.js b/controllers/flight.js index 5d34587..36f091d 100644 --- a/controllers/flight.js +++ b/controllers/flight.js @@ -912,11 +912,13 @@ const getFavoriteDestinations = async (req, res, next) => { const flightDetails = { flightId: destination.flight.id, from: { - departureDate: destination.flight.departureDate, + departureDate: formatDate(destination.flight.departureDate), + departureTime: formatTime(destination.flight.departureDate), departureCity: destination.flight.departureAirport.city, }, to: { - arrivalDate: destination.flight.arrivalDate, + arrivalDate: formatDate(destination.flight.arrivalDate), + arrivalTime: formatTime(destination.flight.arrivalDate), arrivalCity: destination.flight.destinationAirport.city, continent: destination.flight.destinationAirport.continent, diff --git a/test/integrationTest/transaction.test.js b/test/integrationTest/transaction.js similarity index 100% rename from test/integrationTest/transaction.test.js rename to test/integrationTest/transaction.js diff --git a/test/unitTest/utils/formatDate.test.js b/test/unitTest/utils/formatDate.js similarity index 88% rename from test/unitTest/utils/formatDate.test.js rename to test/unitTest/utils/formatDate.js index a3ed283..a993f27 100644 --- a/test/unitTest/utils/formatDate.test.js +++ b/test/unitTest/utils/formatDate.js @@ -20,12 +20,12 @@ describe('Date and Time Formatting Utilities', () => { describe('formatTime', () => { it('should format time to HH:MM', () => { - expect(formatTime('2030-01-01T12:34:56Z')).toBe('12:34'); + expect(formatTime('2030-01-01T12:34:56Z')).toBe('19:34'); }); it('should handle different times correctly', () => { - expect(formatTime('2030-01-01T23:45:00Z')).toBe('23:45'); - expect(formatTime('2030-01-01T00:00:00Z')).toBe('00:00'); + expect(formatTime('2030-01-01T23:45:00Z')).toBe('06:45'); + expect(formatTime('2030-01-01T00:00:00Z')).toBe('07:00'); }); });