Pradeepb Pradeepb - 1 year ago 69
AngularJS Question

angular-moment not displaying time properly

I have below code for displaying date and time.

<span>{{ | 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 Source

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

<span>{{ | amDateFormat:'DD.MM.YYYY HH:mm' }} Uhr</span>
<span>{{event.modificationDate | amDateFormat:'DD.MM.YYYY HH:mm' }} Uhr</span>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download