Commit ef3abaf1 authored by Farid Neshat's avatar Farid Neshat

Fix slashy dates not working.

parent ef75235e
'use strict';
module.exports = (regex, args) => {
// Throw away punctuations. This doesn't support non-english languages
args = args.replace(/([^a-z0-9])/ig, ' ').replace(/\s+/g, ' ');
// Throw away punctuations. This doesn't support non-english languages.
// / and - are for dates.
args = args.replace(/([^a-z0-9/-])/ig, ' ').replace(/\s+/g, ' ');
let previousMatch = regex.exec(args);
......
......@@ -93,6 +93,12 @@ describe('Request', function() {
end: new Date(new Date('9 July 2017') - 1),
});
});
it('Should work with slashy dates!', function () {
expect(script.parseArgs('from 2018/12/19 to 2018/12/28')).to.be.eql({
start: new Date('19 Dec 2018'),
end: new Date(new Date('29 Dec 2018') - 1),
});
});
});
describe('Normalizing Arguments', function () {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment