Shahid Rafiq
Shahid Rafiq

Reputation: 699

html5 input type date format to mm/dd/yyyy causing issue in chrome

I am using following input type in my form, but in chrom it shows datepicker format with d-m-Y, How can I solve this problem

<input class="form-control pull-left datepicker" id="FRAME_DATE" name="FRAME_DATE" style="width:155px;" type="date" data-date-format="MM/DD/YYYY">

Upvotes: 1

Views: 3769

Answers (4)

Umakarthika
Umakarthika

Reputation: 1

Using input type="date" will take the date format of your own computer.

There are no possible ways to change the date format of this HTML element. But we have other options to solve this. You can use datepicker using jQuery or AngularJS to get the custom date format.

Upvotes: 0

Pardeep Jain
Pardeep Jain

Reputation: 86740

Actualy some of the HTML5 tags were not working properly on the chrome. datepicker is one of them. there are lot of alternates for the same to do. i have found one possible solution to this problem you can see here in my fiddle for reffernce.This code is working properly on Mozila as well as on Chrome too.

    <script>
$(function() {
$( "#datepicker" ).datepicker();

});
</script>
</head>
<body>
<p>Your Selected date Is : <input type="text" id="datepicker"></p>

http://jsfiddle.net/Vq65z/504/

Upvotes: 1

Navnish Bhardwaj
Navnish Bhardwaj

Reputation: 1718

Yes, some of HTML5 tags not work well on chrome. You can try this code:

<html>
<head>    
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
</script>
</head>
<body>
Select Date: <input type="text" id="datepicker">
</body>
</html>

Will work 100% for you.

Upvotes: 1

ADiL
ADiL

Reputation: 367

the quickest solution is to change

type="date"

to

type="text"

Upvotes: 2

Related Questions