avoid selecting the day in the previous month

When you select date at the end of the month (27,28,29,30,...) it is likely possible that this date is already displayed by the calender but for the previous month.
Avoid this by using css selector :not()
This commit is contained in:
Jean-Baptiste Bellet
2021-01-27 21:20:38 +01:00
parent 8383b19458
commit fbd6db89c9

View File

@@ -10,7 +10,7 @@ module Features
def select_date_from_datepicker(date)
navigate_datepicker_to_month date
find('.flatpickr-calendar.open .flatpickr-days .flatpickr-day', text: date.strftime("%e").to_s.strip, exact_text: true, match: :first).click
find('.flatpickr-calendar.open .flatpickr-days .flatpickr-day:not(.prevMonthDay)', text: date.strftime("%e").to_s.strip, exact_text: true, match: :first).click
end
def navigate_datepicker_to_month(date, reference_date = Time.zone.today)