mrackley / StratusForms

Lightweight InfoPath alternative for SharePoint 2007,2010,2013,2016,2019 and Office 365
82 stars 36 forks source link

Date not displayed in form #70

Open qaudaffyazmi opened 4 years ago

qaudaffyazmi commented 4 years ago

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.

image

Here is what the json looks like in list, as well as the stored data in column/field FormDate

image

Any help and idea much appreciated. Thanks.

mrackley commented 4 years ago

Hmmm.. I've not tried and HTML5 date picker before, what happens if you just change it back to a normal input box?

danny8000 commented 4 years ago

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