Pradeepb Pradeepb - 18 days ago 5
AngularJS Question

angular-moment not displaying time properly

I have below code for displaying date and time.

<span>{{event.date | amDateFormat:'DD.MM.YYYY HH:MM' }} Uhr</span>
<span>{{event.modificationDate | amDateFormat:'DD.MM.YYYY HH:MM' }} Uhr</span>


and values for each is as below:

$scope.event = {
'date': '2016-11-15T11:13:32+0000',
'modificationDate': '2016-11-15T11:23:24+0000'
}


But its displaying same for both (please refer the screenshot below).

enter image description here

For 'modificationDate' its displaying wrong time. how to resolve this?
plunker here

Answer

You have formatted your time as HH:MM, where the capital M are the months. Instead do it like HH:mm:

<span>{{event.date | amDateFormat:'DD.MM.YYYY HH:mm' }} Uhr</span>
<span>{{event.modificationDate | amDateFormat:'DD.MM.YYYY HH:mm' }} Uhr</span>
Comments