subhra subhra - 6 months ago 13
AngularJS Question

Can not filter the data from as per date using Angular.js

I need one help.I need to filter data from list as per two date using Angular.js.My all code are present inside plunkr.There you can find i have list of 3 set of data.On the to i have two date field one is for

from date
and another is for
to date
. If user is selecting two date the list data will filter accordingly means the list data should view as per selecting dates from date field.Here i can not get that type of result.Here is code.Please help me to resolve this.

Answer

In script.js at line 25 change

getMidnight(event.date + 24 * 3600 * 1000).getTime()

to

getMidnight(new Date(event.date) + 24 * 3600 * 1000).getTime()

Edit:

For the comment, add these two line before return events.filter

from = getMidnight(from);

to = getMidnight(to).getTime() + (24 * 3600-1) * 1000;