I need to include the date in each column of my datatable. The date is received through json and appears as follows:
JSON Date
1504836960000
Currently, I am formatting it using piping and ng-template:
<ng-template pTemplate="body" let-order="rowData">
{{order.sla.slaEnd | date:'yMdjm'}}
</ng-template>
After the formatting, the date looks like this: 8.9.2017, 04:16
Complete code for the column
<p-column field="sla.slaEnd" header="SLA">
<ng-template pTemplate="body" let-order="rowData">
{{order.sla.slaEnd | date:'yMdjm'}}
</ng-template>
</p-column>
The issue arises when sla.slaEnd == null
, resulting in an error and collapsing of the page.
I have made several attempts to address it but have been unsuccessful in checking if sla.slaEnd != null
.
My goal is to determine whether it is null, and if so, display nothing (''). If it is not null, then show the formatted date. Is there a solution to this problem?