Start DatePicker with current day

0

I have a record where I have two dates: DataInicial and DataFinal , I'm using DataPicker to insert both, how can I leave DataInicial always with today's date, I can not allow retroactive dates. I saw some tips like this, but it did not work, see:

Jquery Date Picker Default Date

    
asked by anonymous 12.11.2015 / 13:37

2 answers

3

Try this:

$('#datepicker').datepicker("setDate", new Date());

<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script><divclass="input-append date" id="datepicker" data-date="dateValue: Customer.DateOfBirth" data-date-format="dd-mm-yyyy">
<input class="span2" size="16" type="text" data-bind="value: Customer.DateOfBirth" readonly="readonly" />
<span class="add-on"><i class="icon-calendar"></i>
</span>
</div>

See working at jsfiddle

Refresh:

Set today's date as default date in jQuery UI datepicker

Bootstrap datepicker

    
12.11.2015 / 13:42
0

 
$("#seu_campo_id").datepicker({defaultDate: "getDate()",
                      dateFormat: 'dd/mm/yy',
                      dayNames: ['Domingo','Segunda','Terça','Quarta','Quinta','Sexta','Sábado','Domingo'],
                      dayNamesMin: ['D','S','T','Q','Q','S','S','D'],
                      dayNamesShort: ['Dom','Seg','Ter','Qua','Qui','Sex','Sáb','Dom'],
                      monthNames: ['Janeiro','Fevereiro','Março','Abril','Maio','Junho','Julho','Agosto','Setembro','Outubro','Novembro','Dezembro'],
                      monthNamesShort: ['Jan','Fev','Mar','Abr','Mai','Jun','Jul','Ago','Set','Out','Nov','Dez'],
                      changeMonth: false,
                      numberOfMonths: 1,
                      minDate: 0}).datepicker("setDate", new Date());
 
    
30.10.2017 / 19:03