typescript – get the day name from a date

I tried to get the day name from a date, but with the date 27/02/2021 i get Invalid Date

new Date(exam.examDate).toLocaleString('fr-FR', { weekday: 'long' })

i tried to convert the date using datePipe but it return the below error

Unable to convert "27/02/2021" into a date’ for pipe ‘DatePipe

new Date(this.datePipe.transform(exam.examDate, "dd/MM/yyyy")).toLocaleString('fr-FR', { weekday: 'long' })

7 thoughts on “typescript – get the day name from a date”

Leave a Comment