I have template using date pipe like this
{{value | date: 'dd/MM/yyyy'}}
this value
is null
How to handle this if my value null i got string 'object not match'
?
Angular date pipe used to format dates in angular according to the given date formats,timezone and country locale information. Using date pipe, we can convert a date object, a number (milliseconds from UTC) or an ISO date strings according to given predefined angular date formats or custom angular date formats.
You have to pass the locale string as an argument to DatePipe. var ddMMyyyy = this. datePipe. transform(new Date(),"dd-MM-yyyy");
{{ (value !== null) ? (value | date: 'dd/MM/yyyy') : "" }}
Checked with Angular 4.2.4
{{(value | date:'dd/MM/yyyy') || 'n/a' }}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With