JQuery Mobile / Datebox, the difference between the display date format and the send date format

Is there a way to display the date in the input other than the format I want to send.

For example, I need to send a date in the format "yyyy-mm-dd", but I want to display the date in a different format: "dd / mm / yyyy" (French display). Is there any good advice for this with Datebox for jQuery Mobile (an option I haven't seen?)

I think I need to fool the creation of an input hidden in a good form format, and another with a format for display (and not submitted), but perhaps a better solution exists.

Any ideas?

+4
source share
3 answers

It is best to use 2 inputs - but this is pretty easy to do, and with a callback on a given event, you can even make datebox the second format for you.

http://dev.jtsage.com/jQM-DateBox2/demos/script/split.html

(Note: I just added a demo, so you haven't missed it before)

+3
source

Just a little addition

It should be "overrideDateFormat": "% d /% m /% Y" in the built-in HTML parameters.

The http://dev.jtsage.com/jQM-DateBox2/demos/script/split.html it says "dateFormatOverride": "% d /% m /% Y"}, however this is wrong and that doesn’t work. Just a head for someone else with this problem.

+2
source

Yes, you need to use this method.

<!-- fix american date formatting --> <script type="text/javascript"> jQuery.extend(jQuery.mobile.datebox.prototype.options, { 'overrideDateFormat': '%d/%m/%Y', 'overrideHeaderFormat': '%d/%m/%Y' }); </script> 
+1
source

Source: https://habr.com/ru/post/1433765/


All Articles