Pascal
Pascal

Reputation: 12855

angular 2 date is not rendered with pipe date

I am using angular 2 beta 12.

When I do:

  <div *ngFor="#s of items">
        <div style="font-weight:bold;">
            <p>{{ s.startDate }}</p>
            <p>{{ s.endDate | date }}</p>
        </div>
    </div>

The startDate is displayed.

The endDate using the date pipe does not display the date!

How must the datetime string 'endDate' look like that it is a 'valid' date string for the date pipe?

Upvotes: 0

Views: 439

Answers (1)

kabaehr
kabaehr

Reputation: 1040

This format seems to be invalid. You should see some error messages on your console.

Try to wrap your date into a JS Date Object with endDate = new Date(endDate);

Upvotes: 1

Related Questions