简体   繁体   English

无法使用Angular.js按日期过滤数据

[英]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 . 我需要一个帮助。我需要使用Angular.js每两个日期从列表中过滤数据。我的所有代码都存在于plunkr中 。在那里你可以找到我有3组数据的列表。到我有两个日期字段一个是from date ,另一个是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. 是代码。请帮助我解决此问题。

In script.js at line 25 change 在第25行的script.js中更改

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 对于注释,请在return events.filter之前添加这两行。

from = getMidnight(from);

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM