Hello. What field type are you using in the collection? If it is a date field, then my guess is that toLocaleString is what is messing you up because when you use that, the date is no longer a date object but a string.
I just tested on my site with your code and the string was inserted as expected so this is curious. I noticed that in your screenshot it says that this site has not been published yet. Are you able to publish and test not in preview just to rule out a preview mode oddity?
@amandam&@volkaertskristof const currentdate = d . toLocaleDateString ( ‘en-US’ )
this line solve it thanks for both of you guys
but when amanda said try the published version , there it is another problem.
the code now is running smoothly , but only in preview mode and dose not work in the published site
(what i meant by dose not work that when i go to the collection there is no data have been inserted)
@amandam thank you much
i forgot all about permissions
every thing is amazing right now thank you so much for your time amanda
i really mean it thank you
but i have one last question the format of this date ( 2/24/2022 ) is “mm/dd/yyyy”
but i want it to be “dd/mm/yyyy”
can i do that ?
i did my search online but i jus got lost
@yaser1999yaser No worries at all! It’s always these little things that trip us up.
As for the order, since you are currently using en-US it is formatting for US. I believe en-GB will swap the format for you. If I am wrong, check the options for what you can pass to it in the MDN docs.