0

I have that code:

<input id="date_of_birth" name="date_of_birth" placeholder="dd.mm.yyyy" style=":invalid">
<script>
$("input#date_of_birth").prop('required',!0).attr({'type':'date','max':'2002-12-31','min':'1918-01-01',"pattern":"(?:(?:0[1-9]|1[0-9]|2[0-9])\\.(?:0[1-9]|1[0-2])|(?:30)\\.(?:(?!02)(?:0[1-9]|1[0-2]))|(?:31)\\.(?:0[13578]|1[02]))\\.(?:191[89]|19[23456789]\\d|200[012])",'title':'dd.mm.yyyy.'});
</script>
<style>input#date_of_birth:valid{color:green}input#date_of_birth:invalid{color:red}</style>

http://jsfiddle.net/agtde87f/3/

And I have problem, because Safari doesn't support field type "date" and when someone use "autocomplete forms" then date is filled in that format: 6.02.1999 - but I need that in that format: 06.02.1999

How can I automatically get it it be filled with 0 if there isn't it in day or month?

kibus90
  • 315
  • 2
  • 11
  • https://stackoverflow.com/questions/3605214/javascript-add-leading-zeroes-to-date – BSK Apr 22 '18 at 00:38
  • Hello, Thank you for answer. I saw already that post, but really I dont know how can I use it in my case... – kibus90 Apr 23 '18 at 02:49

0 Answers0