Closed gerontius closed 3 months ago
Where exactly are you using this code?
const submitDate = new Date().toISOString();
Note that there is a locale
prop in the main app config that allows you to set the date locale format.
I think that should help you
Closing for lack of activity
I'm submitting a date time field to a collection and its ending up fine in the collection in date/time format but its not rendering it in the CMS i get incorrect date format error message. I can get it to work by passing it as a string, but not as a date. I tried to get a on_create field working as per the API documentation but i just get an empty read only field. Here is my code in React:
// const submitDate = new Date().toLocaleDateString("en-GB"); //const submitDate = new Date().toLocaleString("en-GB"); const submitDate = new Date().toISOString();
Ive tried all three but same effect.
type Issue = { submitDate: Date; ... }
// doesnt matter what mode i add here }),
It looks like the CMS is expecting MM-DD-YYYY HH:MM and only that. If thats the case it has to be in that format then I will have to stick with the string as UK users will get confused by that.