diff --git a/package.json b/package.json index fdb0a12b..e50170d0 100644 --- a/package.json +++ b/package.json @@ -40,8 +40,8 @@ "devDependencies": { "co": "^4.6.0", "db-stations": "^1.25.0", - "floordate": "^3.0.0", "is-roughly-equal": "^0.1.0", + "luxon": "^0.2.7", "tap-spec": "^4.1.1", "tape": "^4.8.0", "tape-promise": "^2.0.1", diff --git a/test/util.js b/test/util.js index a8cda88e..2d7acaf2 100644 --- a/test/util.js +++ b/test/util.js @@ -1,7 +1,7 @@ 'use strict' const isRoughlyEqual = require('is-roughly-equal') -const floor = require('floordate') +const {DateTime} = require('luxon') const assertValidStation = (t, s, coordsOptional = false) => { t.equal(typeof s.type, 'string') @@ -80,13 +80,12 @@ const assertValidStopover = (t, s, coordsOptional = false) => { assertValidStation(t, s.station, coordsOptional) } -const minute = 60 * 1000 -const hour = 60 * minute -const day = 24 * hour -const week = 7 * day +const hour = 60 * 60 * 1000 +const week = 7 * 24 * hour -// next Monday -const when = new Date(+floor(new Date(), 'week') + week + 10 * hour) +// next Monday 10 am +const dt = DateTime.local().startOf('week').plus({weeks: 1, hours: 10}) +const when = new Date(dt.toISO()) const isValidWhen = (w) => { const ts = +new Date(w) if (Number.isNaN(ts)) return false