Could you please edit your post to include details. You have not asked a question or shown any code, so we have no idea how to help. Could you provide a link to your project as well?
The more information you provide, the more likely we will be able to help.
could you please explain this further. I t is difficult to code it right. " If no date supplied it will use current date. App will return the user object with the exercise fields added."
My code is :
const dateObj = date === '' ? new Date() : new Date(date);
const newExercise = {
_id: userId,
description,
duration,
date: dateObj.toString()
}
if(newExercise.date === '') {
newExercise.date === new Date().toISOString().substring(0, 10)
}
exercises.push(newExercise);
res.json(newExercise)
});
I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.
You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.