Hi Everyone!
I’m finishing up my API Micro Service Exercise Tracker project, and I’ve come up with this issue with the date.
It seems that when I print to console the date shows as follows:
"date": "Fri Dec 20 2019"
This is how the example project shows the dates and that is what I’m going for:
"date": "Tue Dec 17 2019"
So I’m off to a good start…but when I look at the final result, the actual exercise that was saved to the DB it is saved in a different format:
date": "2019-12-19T23:22:25.040Z",
This is the code which saves the new exercise to the DB:
Task.create({
username: found.username,
description: req.body.description,
duration: req.body.duration,
date: req.body.date ? req.body.date : Date(Date.now()).substring(0,16)
},
If the user does not submit a date with the form, the API should use the default date at the moment.
I’ll leave my project link here: https://periodic-jonquil.glitch.me
and Github repo: https://github.com/ezzep66/Exercise-Tracker
I would appreciate any help.
Thanks!