Skip to content

Commit 186c2b3

Browse files
author
David Emory
committed
fix(form): Update OTP query time to current time for any form change in "Depart Now" mode
1 parent 7acbe35 commit 186c2b3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/actions/form.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import debounce from 'lodash.debounce'
22
import qs from 'qs'
3+
import moment from 'moment'
34
import { createAction } from 'redux-actions'
45

56
import { routingQuery } from './api'
@@ -85,8 +86,13 @@ let lastDebouncePlanTimeMs
8586

8687
export function formChanged () {
8788
return function (dispatch, getState) {
88-
dispatch(changingForm())
8989
const otpState = getState().otp
90+
// If departArrive is set to 'NOW', update the query time to current
91+
if(otpState.currentQuery && otpState.currentQuery.departArrive === 'NOW') {
92+
dispatch(settingQueryParam({ time: moment().format('HH:mm')}))
93+
}
94+
95+
dispatch(changingForm())
9096
const {autoPlan, debouncePlanTimeMs} = otpState.config
9197
// check if a trip plan should be made
9298
if (autoPlan && queryIsValid(otpState)) {

0 commit comments

Comments
 (0)