I'm facing an issue with the date formatting using the date pipe in Angular 7.
When I try to format it as date : 'dd/MM/yyyy'
, nothing changes.
The date still appears like this:
Mon Oct 12 1992 00:00:00 GMT-0500 (Central Daylight Time)
I've checked my code in both HTML and .ts files, but can't figure out what the problem is.
I want the date to be shown in this format: dd/MM/yyyy
This is how I'm displaying the date of birth in my HTML:
{{employee.dateOfBirth | date : 'dd/MM/yyyy'}}
And here's a snippet from my TypeScript file (.ts):
dateOfBirth: Date
dateOfBirth: new Date ('10/12/1992')
Even though I'm using the correct formatting syntax {{employee.dateOfBirth | date: 'dd/mm/yyyy' }}, the output remains unchanged. It's frustrating!