Guest User

Untitled

a guest
Feb 19th, 2018
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. .filter('daterangeentrevistado', function () {
  2. return function (conversations, start_date, end_date) {
  3. var result = [];
  4.  
  5. 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;
  6. 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();
  7.  
  8.  
  9. if (conversations && conversations.length > 0) {
  10. $.each(conversations, function (index, conversation) {
  11. 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();
  12.  
  13. if (conversationDate >= start_date && conversationDate <= end_date) {
  14.  
  15. result.push(conversation);
  16. }
  17. });
  18.  
  19. return result;
  20. }
  21. };
  22. });
Add Comment
Please, Sign In to add comment