In my angular component let's say that i have this string '16/12/2020 12:30:00' (french format).
How can I convert this to an Date object in the component ?
expiration_date: Date;
ngOnInit() {
this.dateService.getOne('EXP_DATE').subscribe((data) => {
this.expiration_date = new Date(data.value);
});
console.log(this.expiration_date);
}
I've tried formatDate as well as DatePipe but i get the following message:
"Unable to convert '16/12/2020 12:30:00' into a date".
undefined
new Date(Number(Date.parse(data.value)))