Closed liedekef closed 5 years ago
That option changes both the format in the frontend and in the backend, while I'm searching for a method that shows one format in the frontend and submits in another format.
This is front-end only and has nothing to do with the back-end - that's all yours to build to your likings
...you could, for example, use the onSelect event to populate a hidden field with any format you want and then use that on the backend
@stefangabos but how do you pass that changed format to anywhere? the only date object that i can access within the onselect is the one that is already formatted. and then if i try to pass that into a date object with javascript i get an "invalid date" output.
While I'd love to use Zebra_Datepicker, I couldn't wait for this implementation, so I based myself of another datepicker and made it work the way I like it (and I think it can benefit a lot of people). So feel free to check out my fdatepicker repo (out of respect for the people working hard on this project, I won't directly link to mine).
@zeve-zz the function attached to onSelect
takes 3 arguments. see the documentation
here, I made you an example
@stefangabos ive seen you link the documentation on this issue 3 times but people still have the same question :)
The callback function takes 3 arguments:
"formatted": the date in the format specified by the format attribute "yyyymmdd": the date in YYYY-MM-DD format and additionally hours, minutes and seconds if time picker is enabled "jsobject": the date as a JavaScript Date object
i think it is pretty clear: the function takes 3 arguments. just name them a
, b
& c
and do a console.log()
on them if the docs are not clear. i'll think about it - thank you for the heads up!
Hi,
this seems like a promising project, but is there an alternative format-field option to change the format of the form post field?
Franky