Closed qasim closed 8 years ago
Was originally considering doing this, but was running into a problem when splitting the query, since dateString
contains colons (split
with a limit seems to omit everything after the first occurrence, so .split(':', 1)
doesn't work in this case).
We can use this (let me know if you have a better solution):
x = 'date:"2016-04-01T12:05:30-04:00"'
x = [x.slice(0, x.indexOf(':')), x.slice(x.indexOf(':') + 1)] // ['date', '"2016-04-01T12:05:30-04:00"']
I'm assuming we apply the first case when they provide an empty string, something like date:""
.
That solution looks elegant to me! And I agree with the date:""
.
Looks great!
There are 4 ways to create dates in JS:
Right now, endpoints that take date as part of the filter query support the 4th method. We should add support for the other 3 as well.
I think we'd need a method to differentiate each call in our query parser.
date:1461461852
.date:"2016"
, then that has no commas in it. Maybe we check if the length of the string is 4 or something.Opinions?