StratusForms
StratusForms copied to clipboard
Date not displayed in form
Hi guys,
I have a form with date field named FormDate.
I use default html5 date picker by setting the type="Date"
Here is the code sinppet from form.
<input id="FormDate" listFieldName="FormDate" type="Date"/>
But when I load back the data into form, the date field displayed "mm/dd/yyyy' instead of real date.
Here is what the json looks like in list, as well as the stored data in column/field FormDate
Any help and idea much appreciated. Thanks.
Hmmm.. I've not tried and HTML5 date picker before, what happens if you just change it back to a normal input box?
I think the HTML date input type uses the end-user's computer's local date format. So for en-us, it will display as mm/dd/yyyy. For other countries and languages you should get different formatting. Here is the specs:
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date https://www.w3schools.com/tags/att_input_type_date.asp
Also, not all browsers support the date input, so you should use a "polyfill" for backwards compatibility if you need to support older browsers.
Lastly, there are many articles in the internet that discuss the intricacies of the date input:
http://html5doctor.com/the-woes-of-date-input/ http://form.guide/html5/html-input-type-date-format.html