Mr.Easy Answers McFly Mr.Easy Answers McFly - 8 months ago 31
TypeScript Question

Object.estimated (Kinda of Date object) not being processed to Date() type

I'm receiving this Object.estimated from query to a MongoDB:

Object {estimated: Mon Aug 03 2015 02:00:00 GMT-0500 (COT)}

Then I try to make a Date with it:

new Date(referenceToEstimated)

But I get error:
Invalid Date

I'm using angular2 with typescript by the way, I also tried using datePipe from angular2 and it still gives me error.

I need to make estimated object a Date type object


The Date constructor doesn't know what to do with your arbitrary object.

You can try new Date(referencedToEstimated.estimated) instead.