Greetings,
I am encountering an issue related to converting dates into a specific format that I desire.
Currently, the REST API is sending dates in Milliseconds format
, which I need to convert to a date format like yyyy-MM-dd
for my date-picker component.
The error message states,
Unable to convert "Invalid Date" into a date for pipe "DatePipe".
For your reference - https://i.sstatic.net/8HREA.png
This is a snippet of my code:
this.rest.getprofiledata()
.((resp) =>{
this.data = resp;
this.personal = this.data["message"];
this.d = new Date(this.personal.dob);
this.personal.dob = this.d;
var day = this.d.getDate();
var mon = this.d.getMonth();
var year = this.d.getFullYear();
var dy = this.d.getDay();
dt = new Date(dy,mon,year);
this.personal.dob = dt
} );