I am working on an angular application. I have a date in the format 2020-08-11T19:00:00 but I want date in 1-Jun-2021
format. I tried to do it using date pipe as follows:
{{2020-08-11T19:00:00 | date:'d-MMM-y'}}
But it is giving parse error as
"Parser Error: Unexpected token 'T19'"
How can I do that using date pipe?
Try putting quotes around the date.
{{ '2020-08-11T19:00:00' | date:'d-MMM-y'}}
DatePipe is executed only when it detects a pure change to the input value. A pure change is either a change to a primitive input value (such as String, Number, Boolean, or Symbol), or a changed object reference (such as Date, Array, Function, or Object).
Ref : Angular DatePipe