I have a date object, lets say var myDate = new Date().
Now when I am returning it using res.json({msg: {myDate: myDate}}) the myDate object gets converted into string.I want that the type of myDate should persist. I am using mongoose ODM and express.
JSON doesn't have a date type, which means you have to convert it to date when it reaches the front-end. The JSON spec is here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With