angular - how to use $filter in ionic 2 -


i'm migrating ionic app ionic 2 app, since i'm not expert on ionic 2 got problems doing it.

my question if there function $filter in ionic 2.

this code ionic 1 need convert:

 var group = {};             (var = 0; < orders.length; i++) {                 var dateobj = new date(orders[i].documentdate);                  var date = $filter('date')(dateobj, 'dd-mm-yyyy');                  dateobj = new date(orders[i].edimessagedate);                 orders[i].time = $filter('date')(dateobj, 'hh:mm');                  if (angular.isdefined(group[date])) {                      group[date].push(orders[i]);                 } else {                     group[date] = [orders[i]]                 }             } 

so far have done this:

let group = {};   for(let  = 0; i<orders.length; i++){        let dateobj = new date(orders[i].documentdate);       let date = $filter('date')(dateobj, 'dd-mm-yyy');        dateobj = new date(orders[i].edimessagedate);       orders[i].time = $filter('date')(dateobj, 'hh:mm');        if(group[date] != null)           group[date].push(orders[i]);       else           group[date] = [orders[i]];    } 

but don't know how can replace:

$filter('date')(dateobj, 'dd-mm-yyy'); 

to ionic 2. advice?

thank help.

you have 2 options here.

option 1: can use momentjs

option 2: can use angular datepipe.

{{yourdate | date: 'dd/mm/yyyy'}} 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -