Skip to content

Commit

Permalink
Remove date time from time slots request
Browse files Browse the repository at this point in the history
  • Loading branch information
lyyder committed Aug 16, 2018
1 parent 30a49d7 commit 27462b5
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/containers/ListingPage/ListingPage.duck.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,13 @@ export const fetchTimeSlots = listingId => (dispatch, getState, sdk) => {
const bookingRange = config.dayCountAvailableForBooking - 1;
const timeSlotsRange = Math.min(bookingRange, maxTimeSlots);

const start = moment().toDate();
const start = moment
.utc()
.startOf('day')
.toDate();
const end = moment()
.utc()
.startOf('day')
.add(timeSlotsRange, 'days')
.toDate();
const params = { listingId, start, end };
Expand All @@ -213,11 +218,8 @@ export const fetchTimeSlots = listingId => (dispatch, getState, sdk) => {
.then(timeSlots => {
const secondRequest = bookingRange > maxTimeSlots;

// time slots request end can be at most 179 days from now
const secondMaxTimeSlots = maxTimeSlots - 1;

if (secondRequest) {
const secondRange = Math.min(secondMaxTimeSlots, bookingRange - maxTimeSlots);
const secondRange = Math.min(maxTimeSlots, bookingRange - maxTimeSlots);
const secondParams = {
listingId,
start: end,
Expand Down

0 comments on commit 27462b5

Please sign in to comment.