Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .filter('daterangeentrevistado', function () {
- return function (conversations, start_date, end_date) {
- var result = [];
- var start_date = start_date ? new Date(start_date.substring(start_date.length - 4, start_date.length) + "/" + start_date.substring(start_date.length - 7, start_date.length - 5) + "/" + start_date.substring(0, start_date.length == 10 ? 2 : 1)).getTime() : 0;
- var end_date = end_date ? new Date(end_date.substring(end_date.length - 4, end_date.length) + "/" + end_date.substring(end_date.length - 7, end_date.length - 5) + "/" + end_date.substring(0, end_date.length == 10 ? 2 : 1)).getTime() : new Date().getTime();
- if (conversations && conversations.length > 0) {
- $.each(conversations, function (index, conversation) {
- var conversationDate = new Date(conversation.datanascimento.substring(conversation.datanascimento.length - 4, conversation.datanascimento.length) + "/" + conversation.datanascimento.substring(conversation.datanascimento.length - 7, conversation.datanascimento.length - 5) + "/" + conversation.datanascimento.substring(0, conversation.datanascimento.length == 10 ? 2 : 1)).getTime();
- if (conversationDate >= start_date && conversationDate <= end_date) {
- result.push(conversation);
- }
- });
- return result;
- }
- };
- });
Add Comment
Please, Sign In to add comment