From 5d7943edcf68bcb2029e548a7b76cf7c8af500cd Mon Sep 17 00:00:00 2001 From: Joao Pedro Henrique Date: Mon, 26 Dec 2022 19:25:47 -0300 Subject: [PATCH] refactor: fix inconsistencies due to timestamp --- .../rpl-crawler/src/flight-decoder/flight-decoder-utils.ts | 2 +- .../rpl-crawler/tests/flight-decoder/flight-decoder.test.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/rpl-crawler/src/flight-decoder/flight-decoder-utils.ts b/packages/rpl-crawler/src/flight-decoder/flight-decoder-utils.ts index b21b72b7..dabdb458 100644 --- a/packages/rpl-crawler/src/flight-decoder/flight-decoder-utils.ts +++ b/packages/rpl-crawler/src/flight-decoder/flight-decoder-utils.ts @@ -14,7 +14,7 @@ export const resolveFlightDate = (date: string): Date => { const month = parseInt(date.substr(2, 2)) - 1 const year = parseInt(date.substr(4, 2)) + 2000 - return new Date(year, month, day) + return new Date(Date.UTC(year, month, day)) } export const resolveWeekDays = (weekdays: string): Weekdays[] => { diff --git a/packages/rpl-crawler/tests/flight-decoder/flight-decoder.test.ts b/packages/rpl-crawler/tests/flight-decoder/flight-decoder.test.ts index 98891ae2..5582fcd9 100644 --- a/packages/rpl-crawler/tests/flight-decoder/flight-decoder.test.ts +++ b/packages/rpl-crawler/tests/flight-decoder/flight-decoder.test.ts @@ -13,8 +13,8 @@ describe('flight-decoder', () => { @` const flight = flightDecoder(line) - expect(flight.beginDate).toEqual(new Date('2020-07-23')) - expect(flight.endDate).toEqual(new Date('2020-10-01')) + expect(flight.beginDate).toEqual(new Date(Date.UTC(2020, 6, 23))); + expect(flight.endDate).toEqual(new Date(Date.UTC(2020, 9, 1))); }) test('Given flight with IFR Flight Rule', () => {