Skip to content

Commit

Permalink
fix(places): corrected sunday behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
FabrizioCostaMedich committed Jan 11, 2025
1 parent 715e635 commit 7dc0421
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/features/places/screens/FreeRoomsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ const findNearestSlotStartHour = (dt: DateTime) => {

// Skip Sundays
if (dt.weekday === 7) dt = dt.plus({ day: 1 }).startOf('day');
if (maxDate.weekday === 7) maxDate = maxDate.plus({ day: 1 }).startOf('day');
if (maxDate.weekday === 7) maxDate = maxDate.plus({ day: 1 }).endOf('day');

const nearestStartHourIndex = slotStartHour.findIndex(h => h <= dt.hour);
if (nearestStartHourIndex >= 0 && dt.hour < 20) {
Expand Down Expand Up @@ -140,12 +140,20 @@ export const FreeRoomsScreen = ({ navigation }: Props) => {
useEffect(() => {
if (
startDateTime.equals(
DateTime.now().plus({ day: 1 }).set({
hour: slotStartHour[0],
minute: 0,
second: 0,
millisecond: 0,
}),
DateTime.now()
.plus({
day:
DateTime.now().plus({ day: 1 }).set({ hour: slotStartHour[0] })
.weekday === 7
? 2
: 1,
})
.set({
hour: slotStartHour[0],
minute: 0,
second: 0,
millisecond: 0,
}),
)
) {
if (showFeedback) {
Expand Down

0 comments on commit 7dc0421

Please sign in to comment.