AngularDeveloper AngularDeveloper - 4 months ago 7
AngularJS Question

I'm not able to bind time correctly in table

I tried by placing lot of directives to display correct time in table.But I couldn't make this done.I'm sharing the fiddle here.The time in table is 5:30 min more than what I have given.Please help me to solve this.
Jsfiddle

Thanks

Answer

The issue is the timezone, You need to convert using a filter to local timezone,

You could check this by adding like this,

<td>{{row.description  | UTCToNow  }}</td>

Filter:

myapp.filter('UTCToNow', ['moment', function (moment) {
     return function (input, format) {
           return  moment.utc(input).format('LLL');        

         }
    }]
);

JSFiddle