Datatable Column Template (Date format)

UI Components for Angular
Post Reply
mauroms02
Posts: 13
Joined: 28 Jun 2016, 17:02
Location: United Kingdom

02 Nov 2016, 14:22

Hey Guys,
I'm trying to format the field orderDate (Date type) to looks like '11/06/2014' but no matter what I use inside the template, it always display as 2014-06-11T11:48:24

That's the column/template I'm using.
I've checked other posts and ppl say that this guy below should work fine.

Could you please let me know if I'm missing something?
ps: I'm on primeng 1.0.0-beta.20 and Angular 2.1.1

Code: Select all

<p-column field="orderDate" header="Order Date & Time" sortable="true" styleClass="pick-creation-orderDateColumn">
      <template let-pick="rowData">
            {{pick.orderDate | date: 'dd/MM/yyyy'}}
      </template>
-column>

Regards,
Mauro

mauroms02
Posts: 13
Joined: 28 Jun 2016, 17:02
Location: United Kingdom

02 Nov 2016, 16:28

Sorry guys... Silly mistake... At some point pTemplate was added and I didn't notice :)

Code: Select all

<p-column field="orderDate" header="Order Date & Time" sortable="true" styleClass="pick-creation-orderDateColumn">
                <template let-pick="rowData" pTemplate type="body">
                    {{pick.orderDate | date: 'dd/MM/yy HH:mm'}}
                </template>
</p-column>

Post Reply

Return to “PrimeNG”

  • Information
  • Who is online

    Users browsing this forum: No registered users and 9 guests