A
A
alabs2015-09-25 12:47:22
JavaScript
alabs, 2015-09-25 12:47:22

Which calendar to use with a choice of interval and taking into account unavailable dates?

Good afternoon.
Prompt a calendar on jquery with a choice of an interval and taking into account unavailable dates.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
alabs, 2015-09-25
@alabs

If anyone is interested, I wrote to the usual UI Datapicker.
Warning! Bugs are possible.

<style>
    .ui-datepicker-calendar td{
      padding:0 !important;
    }
    .dp-highlight .ui-state-default {
      background: #484;
      color: #FFF;
    }
  </style>
  <script>
 
    $(function() {
      var array = ["2015-09-27","2013-03-15","2013-03-16"];
      
      $("#datepicker").datepicker({
        beforeShowDay: function(date) {
          var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input1").val());
          var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input2").val());
          var string = jQuery.datepicker.formatDate('yy-mm-dd', date);
          
          if(array.indexOf(string) != -1){
            return [false, ""];
          }else{
            return [true, date1 && ((date.getTime() == date1.getTime()) || (date2 && date >= date1 && date <= date2)) ? "dp-highlight" : ""];
          }					
          
        },
        minDate:1,
        onSelect: function(dateText, inst) {
          var date1 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input1").val());
          var date2 = $.datepicker.parseDate($.datepicker._defaults.dateFormat, $("#input2").val());
          if (!date1 || date2) {
            $("#input1").val(dateText);
            $("#input2").val("");
            if($(this).datepicker("option", "minDate")<$("#input1").val(dateText)){
              $(this).datepicker("option", "minDate", dateText);
            }						
          } else {
            $("#input2").val(dateText);
            $(this).datepicker("option", "minDate", $(this).datepicker("option", "minDate"));
          }
        }
      });
    });
  </script>

H
Hazrat Hajikerimov, 2015-09-25
@hazratgs

Here's a choice , look, test, choose.

A
Arvils, 2015-09-25
@arvazzz

www.daterangepicker.com I use it myself.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question