Skip to content

Commit

Permalink
validate dates for bookings
Browse files Browse the repository at this point in the history
Signed-off-by: Tomás Castillo <[email protected]>
  • Loading branch information
tomrndom committed May 31, 2024
1 parent 1e8b1b9 commit 0f5995a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,13 @@ export const getAvailableBookingDates = (summit) => {
} = summit;
let bookStartDate = epochToMomentTimeZone(begin_allow_booking_date, time_zone_id);
let bookEndDate = epochToMomentTimeZone(end_allow_booking_date, time_zone_id);
let isValidStartDate = (new Date(begin_allow_booking_date)).getTime() > 0;
let isValidEndDate = (new Date(end_allow_booking_date)).getTime() > 0;
let now = moment().tz(time_zone_id);
let dates = [];

if(!isValidStartDate || !isValidEndDate) return dates;

while (bookStartDate <= bookEndDate) {
if (bookStartDate >= now) {
const tmp = bookStartDate.clone();
Expand Down

0 comments on commit 0f5995a

Please sign in to comment.