Second datePicker can not select a date less than the first


Topic: Second datePicker can not select a date less than the first datePicker

AMCode asked 6 years ago

As a title I have implemented two datePicker within my project, my goal is that the second datePicker can not select a date before the date selected in the first datePicker.

<div class="col-md-4">
<form name="NOME_FORM" method="post" action="registra_campagne.php" class="text-center border border-light p-5" onsubmit="return validateForm()">
<p class="h4 mb-4">Durata Campagna</p>
<div class="md-form">
<!--The "from" Date Picker -->
<input name="data_inizio" required placeholder="Data inizio" type="text" id="date-picker-example" class="form-control datepicker" >
<label for="date-picker-example">Inizio</label>

</div>
<div class="md-form">
<!--The "to" Date Picker -->
<input name="data_fine" placeholder="Data Fine" type="text" id="date-picker-example2" class="form-control datepicker">
<label for="date-picker-example2">Fine</label>
</div>
<input class="btn btn-info btn-block" name="submit" type="submit" value="Aggiungi"><br>
</form>

</div>


<div class="col-md-4"></div>
</div>
</div>
</div>

<script type="text/javascript" src="datepicker.js"></script>
<script type="text/javascript">


// Data Picker Initialization
$('.datepicker').pickadate({
min : new Date(),
onClose: function(){
$('#date-picker-example2').pickadate({
min : $('.datepicker').val()
})
}
});

$('.datepicker').pickadate({
// Escape any “rule” characters with an exclamation mark (!).
format: 'yyyy/mm/dd',
formatSubmit: 'Y/m/d',
hiddenPrefix: 'prefix__',
hiddenSuffix: '__suffix'
})

$('.datepicker').pickadate({
closeOnSelect: false,
closeOnClear: false

});
$('#input_starttime').pickatime({
twelvehour: true

});
$('#input_endtime').pickatime({
darktheme: true,
twelvehour: false

});
</script>

Mikołaj Smoleński staff answered 6 years ago

Hi there,

Date Picker is a premium component, and according to our system, you use MDB Free version.

Please, provide us a number o your order or registered email to confirm your access to MDB Pro components and premium support.

Send it to me on email: m.smolenski@mdbootstrap.com

Best,
Mikołaj Smoleński


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Answered

Specification of the issue
  • User: Free
  • Premium support: No
  • Technology: MDB jQuery
  • MDB Version: 4.3.2
  • Device: pc
  • Browser: chrome
  • OS: mac
  • Provided sample code: Yes
  • Provided link: No
Tags