From 72466138c86bb80bf51b106db1af368fc522157b Mon Sep 17 00:00:00 2001 From: Rylan Hawkins Date: Thu, 2 Mar 2017 10:46:01 -0800 Subject: [PATCH 1/2] Support 'now' as a date Google Maps supports 'now' as a date --- lib/utils/assignParams.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils/assignParams.js b/lib/utils/assignParams.js index fc11cf7..e0f9e44 100644 --- a/lib/utils/assignParams.js +++ b/lib/utils/assignParams.js @@ -30,7 +30,7 @@ var check = require('check-types'); if (expectedType == 'date') { - if (check.date(newParams[ key ])) { + if (newParams[ key ] == 'now' || check.date(newParams[ key ])) { params[ key ] = newParams[ key ]; } From d7b2cda52849db9dd6576cf966abb7e77a59b57f Mon Sep 17 00:00:00 2001 From: Rylan Hawkins Date: Thu, 2 Mar 2017 12:31:30 -0800 Subject: [PATCH 2/2] Don't try to make now a number --- lib/utils/travelUtils.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/utils/travelUtils.js b/lib/utils/travelUtils.js index 78376ea..3b54f4a 100644 --- a/lib/utils/travelUtils.js +++ b/lib/utils/travelUtils.js @@ -18,7 +18,7 @@ travelUtils.validateCommonArgs = function(args) { if (args.waypoints != null) { throw new Error('It is not possible to specify waypoints when params.mode = transit'); } - } + } } if (args.avoid != null) { @@ -60,7 +60,7 @@ travelUtils.validateCommonArgs = function(args) { travelUtils.convertTargetTimes = function(args) { // convert departure_time in UNIX timestamp - if (args.departure_time != null) { + if (args.departure_time != null && args.departure_time != 'now') { args.departure_time = Math.floor( args.departure_time/1000 ) }