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 2d1fbe7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/containers/ListingPage/ListingPage.duck.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,8 @@ export const fetchTimeSlots = listingId => (dispatch, getState, sdk) => {
const bookingRange = config.dayCountAvailableForBooking - 1;
const timeSlotsRange = Math.min(bookingRange, maxTimeSlots);

const start = moment().toDate();
const end = moment()
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 +213,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 2d1fbe7

Please sign in to comment.