0

I use input type "date" with jquery mobile. But for each device it display different result. + Android operating system: choose input date the same type of android calendar + iOS: choose input date date the sam type of iOS + Desktop: choose input date the same type of operating system install on desktop

I want display dd/MM/yyyy format standard for all device. How to custom format default input date???

Thank you so much!

1 Answers1

1

You can do this, but this is too much of a waste of time and involves cumbersome use of HTML5's localStorage api. For more info, look at this question. In this case also, it's not possible to make type=date behave uniformly in all browsers because each browser handles this differently and you don't have any control over it.

HTML5's standards indicate usage of YYYY-MM-DD format but the browsers sniff your local date format and use that. See this from w3:

The format used "on the wire", i.e. in HTML markup and in form submissions, is intended to be computer-readable and consistent irrespective of the user's locale. Dates, for instance, are always written in the format "YYYY-MM-DD", as in "2003-02-01". Users are not expected to ever see this format.

and this question at jquery Mobile site.

All this must tell you that doing this will take a lot of effort from you. Instead, it would be better if you use some other alternative to this, taken from this question like this : http://jsbin.com/ukelis/1/edit

you could change the dateformat in the altFormat option in the JS and make this work for you. You could also look at this - a mobile version for jquery UI's datepicker.

Community
  • 1
  • 1
krishwader
  • 11,341
  • 1
  • 34
  • 51
  • please be sure to mark this as the best answer if you feel this has helped you and upvote it if u think this will help others. :) – krishwader Jun 13 '13 at 08:11