Problem with date format #704
-
Hello everyone, Can someone please help me with this? Many thanks in advance! Here is my PR: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
There are a couple of things you need to change.
<button onClick={() => router.push(`/journey-list/${entry.id}`)}>
Edit
</button>
const [date, setDate] = useState(selectedEntry?.date || new Date());
const dateParts = newEntry.date.split("-");
const formattedDate = `${dateParts[2]}.${dateParts[1]}.${dateParts[0]}`;
newEntry.date = formattedDate;
value={date} This should fix all your issues concerning dates. You can delete the |
Beta Was this translation helpful? Give feedback.
-
Hi Ernst, Another problem arises when I implement your changes: I get the error message that onSubmit(newEntry) is not a function. |
Beta Was this translation helpful? Give feedback.
There are a couple of things you need to change.
[id].js
is in the wrong place. Move it from thepages
folder down into thejourney-list
folder.EntryList
EntryForm
handleSubmit
of yourEntryForm
EntryForm
change the value of the date input field to thisThi…