Datepicker-bootstrap current date

0

How do I make the datepicker-bootstrap put the current date by default in the input, I checked in some forums and nothing that they use is jqueri-UI

    
asked by Antonio 29.08.2018 в 19:48
source

2 answers

1

You assign it directly to the input value or its setDate function

$('.datepicker').datepicker("setDate", new Date());
<link srv="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/css/bootstrap-datepicker.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.8.0/js/bootstrap-datepicker.min.js"></script>
<input class="datepicker">
    
answered by 29.08.2018 / 20:37
source
1

Try this example for the current date:

input type="date" name="cumpleanios" step="1" min="2013-01-01" 
max="2013-12-31" value="<?php echo date("Y-m-d");?
    
answered by 29.08.2018 в 19:56