We got a website that makes a json request to the server. The server returns these kind of items:
var items = new Array();
items[] = {
id: 1
date: '2011-12-01',
time: '03:00:00'
endDate: '2011-12-04',
endTime: '05:00:00'
}
Now what I got is a date filter on the client side, so you can pick a filter and then it will only return the items matching that date. But here is the problem:
Lets say the users picks a date for example: “2011-12-02”, it will ONLY look at the “date” element in the array, however if the endDate is not null (because it is not required, then the item will last one day) it has to match between those periods, so 2011-12-02 would still return the item since the begin date was 2011-12-01 and the end date was 2011-12-04 so it is between those 2 dates, so I would still have to get the item.
How do I solve this?
You actually have to parse those dates and check the range.
For example,
taken from other question
hope this helps your further…