Google Chrome inserting datepicker in inputs

1

I'm having problems with <input> tags of type type="date" , as shown below, when the user uses Chrome (ie in Firefox it works as expected).

<input name="dt_fim" id="dt_fim" type="date" placeholder="99/99/9999" value="<?=$dt_fim?>" maxlength="10" pattern="(0[1-9]|1[0-9]|2[0-9]|3[01])\/(0[1-9]|1[012])\/2[0-9]{3}" required>

Chrome discards value="" when it receives a ready date for the input, returns it in the wrong format when the user types manually, and adds a date picker in the input I did not request.

Now, the obvious solution is to make the type be text type="text" , but according to HTML5 I could / should flag as date type type="date" , because so it is.

Is there anything I can do in my sources in order to fix or prevent this, in addition to setting the input as text? Is this a mistake of mine?

    
asked by anonymous 28.07.2017 / 17:33

2 answers

2

In fact it is correct only in chrome, firefox does not support input="date" and uses fallback of input="text" , if you do not want datepicker, use input="text" same

link

    
28.07.2017 / 17:50
0

I've had the same problem a few times, if you're not in a hurry, you can use jquery to create calendar inputs.

    
30.07.2017 / 06:26