T00rk / bootstrap-material-datetimepicker

Datepicker for bootstrap-material
http://t00rk.github.io/bootstrap-material-datetimepicker/
MIT License
9 stars 4 forks source link

Hide time #234

Open rohit715131 opened 4 years ago

rohit715131 commented 4 years ago

Hi team , I am using two times picker once select time and another one hide before time whatever i select. example: I selected 10am after that 0 to 10 will be hide, not able to select. Please help me out.

saumayaranjan commented 4 years ago

$(document).ready(function () { $("#from_date").bootstrapMaterialDatePicker({ weekStart: 0, format: "YYYY-MM-DD HH:mm:ss", defaultDate: moment(min_date), useCurrent: false, minDate: moment(min_date), value: min_date, }) .on("change", function (e, date) { max_date = new Date(date); max_date.setHours(24); $("#to_date").bootstrapMaterialDatePicker("setMinDate",max_date); });

              $("#to_date")
                .bootstrapMaterialDatePicker({
                  weekStart: 0,
                  format: "YYYY-MM-DD HH:mm:ss",
                  defaultDate: moment(max_date),
                  minDate: moment(min_date),
                  value: max_date,
                })
                .on("change", function (e, date) {
                  max_date = new Date(date);
                  max_date.setDate(max_date.getDate());
                  $("#from_date").bootstrapMaterialDatePicker(
                    "setMaxDate",
                    date
                  );
                });
            });