Skip to content

Commit

Permalink
Merge pull request #174 from FSW-AND-BINAR-BATCH-6/feat/flight
Browse files Browse the repository at this point in the history
edit: change favorite destination date format
  • Loading branch information
vierynugroho authored Jun 27, 2024
2 parents d04a755 + 86f0fd6 commit 10b252b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions controllers/flight.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
});

Expand Down

0 comments on commit 10b252b

Please sign in to comment.