angularjs - angular filter is date time format-er -


i have angular filter , show wrong time json '2015-04-09t16:30:00' problem show time 2015-04-09 12:30 pm off 4 hour of correct time how can show corect time ?

app.filter('formatdateandtime', function () {     return function (input){         if (moment.utc(input).local().format('mm/dd/yyyy hh:mm ') === 'invalid date')             return ' ';         else             return moment.utc(input).local().format('mm/dd/yyyy hh:mm ');     }; }); 

the moment.utc(x) call interprets input utc time , .local() outputs in local timezone, 4 hours off.

oops, missed part of question getting same time. see ben whitney's answer (use moment(input) instead of moment.utc(input))


Popular posts from this blog