I have the following datepicker:
var dataIni = document.querySelector("#calendarioIni");
var dataFim = document.querySelector("#calendarioFim");
function checaVazio(){
var botao = document.querySelector("form input[type='submit']");
botao.style.display = dataIni.value && dataFim.value ? "inline" : "none";
}
var start = new Date(1998, 00, 01);
var end = new Date(1998, 11, 31) ;
$(document).ready(function()
{
$('#calendarioIni').datepicker({
format: 'dd/mm/yyyy',
startDate: '01/01/1998', // 1 de Janeiro de 1998
endDate: '31/12/1998', // 31 de Janeiro de 1998,
defaultViewDate: { year: 1998, month: 0, day: 1 },
onSelect: checaVazio
});
});
$(document).ready(function()
{
$('#calendarioFim').datepicker({
defaultViewDate: new Date(1998, 0, 1),
endDate: end,
startDate: start,
onSelect: checaVazio
});
});
I would like to change the month that appears when I open the calendar (currently when I click open in December, I want to change to January), I tried doing this with "startView" but it did not work. As soon as I use it:
<form method="post" action="">
Início do período:
<input type="text" id="calendarioIni" name="dataInicio">
Fim do período:
<input type="text" id="calendarioFim" name="dataFim">
<input style="display: none;" type="submit" value="Consultar" />
<br><br><br>
<?php if(isset($_POST['dataInicio']) && isset($_POST['dataFim']))
{
$dataIni = $_POST['dataInicio'];
$dataFim = $_POST['dataFim'];
echo $dataIni."<br>";//Teste para verificar o valor nas variáveis que recebem a data via POST
echo $dataFim."<br>";
}
?>
</form>