From adde38587bdda1b5b38d18b891c79e21e8ddb67d Mon Sep 17 00:00:00 2001 From: Shaed Parkar Date: Tue, 12 Sep 2023 00:18:15 +0100 Subject: [PATCH] sonar house keeping --- .../ClientApp/src/app/services/bookings-list.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts index 1c2ee66ca..95dc61752 100644 --- a/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts +++ b/AdminWebsite/AdminWebsite/ClientApp/src/app/services/bookings-list.service.ts @@ -134,13 +134,15 @@ export class BookingsListService { private insertDateGroup(element: BookingsListModel, bookings: Array) { bookings.push(element); bookings.sort((a, b) => { - if (new Date(a.BookingsDate) < new Date(b.BookingsDate)) { + const dateA = moment(a.BookingsDate); + const dateB = moment(b.BookingsDate); + if (dateA.isBefore(dateB)) { return -1; } - if (new Date(a.BookingsDate) > new Date(b.BookingsDate)) { + if (dateA.isAfter(dateB)) { return 1; } - if (new Date(a.BookingsDate) === new Date(b.BookingsDate)) { + if (dateA.isSame(dateB)) { return 0; } });