0
I am working on a simple project for a hostel, on the website has a small form of stable request. It has two fields to select the input date and another to select the output date. I’m using the library http://amsul.ca/pickadate.js/ because I’ve been working with her for a long time.
The problem is that I am not finding a way for the second input where will load the departure date, is higher than the date selected in the arrival field, also has on these ticket shopping websites. Someone give me a light?
$('.data1').pickadate({
formatSubmit: 'yyyy/mm/dd',
closeOnSelect: true,
closeOnClear: true,
monthsFull: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthsShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
weekdaysFull: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'],
weekdaysShort: ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sab'],
today: 'hoje',
clear: 'limpar',
close: 'fechar',
format: 'dd/mm/yyyy'
});
$('.data2').pickadate({
formatSubmit: 'yyyy/mm/dd',
closeOnSelect: true,
closeOnClear: true,
monthsFull: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
monthsShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
weekdaysFull: ['domingo', 'segunda-feira', 'terça-feira', 'quarta-feira', 'quinta-feira', 'sexta-feira', 'sábado'],
weekdaysShort: ['dom', 'seg', 'ter', 'qua', 'qui', 'sex', 'sab'],
today: 'hoje',
clear: 'limpar',
close: 'fechar',
format: 'dd/mm/yyyy'
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="https://parahybahostel.com.br/js/picker.js"></script>
<script src="https://parahybahostel.com.br/js/picker.date.js"></script>
<link href="https://parahybahostel.com.br/css/classic.css" rel="stylesheet" />
<link href="https://parahybahostel.com.br/css/classic.date.css" rel="stylesheet" />
<form method="POST">
Entrada:
<input type="text" name="chegada" class="data1" value="" />
<br />
<br /> Saída:
<input type="text" name="saida" class="data2" value="" />
</form>
is using any bakc-end language? can include part of the code for testing ?
– Julio Henrique
@Juliohenrique97 am not using no, I enter the code, as you can see, the library already displays the whole calendar
– Sérgio Machado
you want that when selecting the first date the second can not be placed if a date less than the first date is selected ?
– Julio Henrique
that’s right, just like in this example here https://jqueryui.com/datepicker/#date-range
– Sérgio Machado
In that case I think my answer would be useful but not the way you wanted it
– Julio Henrique
Exactly, it worked, but not the way I wanted rs, I’m trying to adapt here but I can’t get the value of the data1 ID and use in the min parameter
– Sérgio Machado
I’ve already developed the code for you, I’m posting the answer
– Julio Henrique
I’ve posted a solution
– Julio Henrique