Show date in DD/MM/YYYY and store in the input value in YYYY/MM/DD for mySQL and also applied the 'startDate' on a type of datepicker range.
When I send the form by post, I get the date in DD / MM / YYYY.
Also, if I use "toValue / toDisplay" the "startDate" does not work.
1.6.4.
https://jsfiddle.net/ue3xb4bf/
Thanks for your help, and sorry for my english.
Hi
You misunderstood the documentation.
toDisplay aim to set the output format of dates, for both UI and input.
toValue aim to set the input format, which the plugin will use in order to parse date wrote in the input.
If you want to store a different format than the one displayed, you should add another hidden input and store the date in the wished format when toDisplay is running.
Hi Azaret,
Documentation is not misunderstood. This is what documentation states:
So, in first place, there is a lack of clarity in the documentation.
And, in second place, are you seriously telling me to use a hidden input (beeing forced to link and update it via jQuery) when it's as simple as having two functions, one for changing the input text (what is displayed) and another one for changing the input value (what is sent within the form)? That is the worst idea taking into account source maintanability and coding best practices.
Symfony, Laravel... Even via custom JavaScript, is so damm easy to have, in an input, one value displayed and one value to be sent.
Do you have any plans in further versions to include that functionality? I've to do it manually via input hidden and custom JavaScript, I'd rather prefer search for another library.
Hi Azaret,
Documentation is not misunderstood. This is what documentation states:
- toDisplay: function (date, format, language) to convert date object to string, that will be stored in input field
- toValue: function (date, format, language) to convert string object to date, that will be used in date selection
So, in first place, there is a lack of clarity in the documentation.
And, in second place, are you seriously telling me to use a hidden input (beeing forced to link and update it via jQuery) when it's as simple as having two functions, one for changing the input text (what is displayed) and another one for changing the input value (what is sent within the form)? That is the worst idea taking into account source maintanability and coding best practices.
Symfony, Laravel... Even via custom JavaScript, is so damm easy to have, in an input, one value displayed and one value to be sent.
Do you have any plans in further versions to include that functionality? I've to do it manually via input hidden and custom JavaScript, I'd rather prefer search for another library.
Could you just make one simple example of these toValue and toDisplay thing? @Azaret
2020 and still an issue.
Ugh, didnt realize this was the case. Definitely need to be able to display different to the user without creating a storage headache.
Most helpful comment
Hi Azaret,
Documentation is not misunderstood. This is what documentation states:
So, in first place, there is a lack of clarity in the documentation.
And, in second place, are you seriously telling me to use a hidden input (beeing forced to link and update it via jQuery) when it's as simple as having two functions, one for changing the input text (what is displayed) and another one for changing the input value (what is sent within the form)? That is the worst idea taking into account source maintanability and coding best practices.
Symfony, Laravel... Even via custom JavaScript, is so damm easy to have, in an input, one value displayed and one value to be sent.
Do you have any plans in further versions to include that functionality? I've to do it manually via input hidden and custom JavaScript, I'd rather prefer search for another library.