0

I tried to use Kendo Datetimepicker's configuration to set min time starts at 09:00 AM.

like below:

    $("#txtAppt_Date").kendoDateTimePicker({
                    format: 'ddd M/d/yyyy h:mm tt',
                    min: new Date(2017, 0, 1, 9, 0, 0)
     });

But I am only allow to set 2017-01-01's time only. Not work for 2017-01-02 or any other dates.

I want to have range between 09:00 AM to 11:00 PM for this Kendo Datetimepicker.

Please help.

Thanks.

Update This question is solved: I referenced Setting DateTimePicker to show specific time range e.g. working hours only

Seong Kim
  • 535
  • 5
  • 22

1 Answers1

1

You can set min and max as follows:

<input id="datetimepicker" />
<script>
$("#datetimepicker").kendoDateTimePicker({
    value: new Date(2011, 0, 1, 9, 0, 0),
    min: new Date(2011, 0, 1, 9, 0, 0),
    max: new Date(2011, 0, 1, 23, 0, 0)
});
</script>

Pay attention that you should provide a value within the range of min and max.

See the embedded links above for more information.

Thanks to @Erik, here's a demo fiddle.

UPDATE
If what you want is to restrict the time 9-23 across multiple days, then there's a good answer here that demos it here

Tal
  • 145
  • 8
  • 1
    Please read my queston. It won't work for 2011-01-02 to have min 08:00AM!! – Seong Kim Dec 14 '17 at 17:27
  • Try it on your own, you won't have min time (ex. 08:00AM) for any other dates than 2011-1-1. Try pick 2011-1-2 and see you can select 07:00AM or not. – Seong Kim Dec 14 '17 at 17:32
  • 1
    @SeongKim you should provide a `value` within the range of `min` and `max`. Answer has been updated – Tal Dec 14 '17 at 17:47
  • Why not [make a fiddle](https://jsfiddle.net/shfm16af/) and fiddle with it? :) @SeongKim is right. When picking a time for 2011-1-2 change the min and max again and value should always be in range on min and max. – erikvimz Dec 14 '17 at 17:55
  • @ErikKralj good idea, I'll do it next time, now I'll just steal yours ;) – Tal Dec 14 '17 at 18:10
  • 2
    @Tali Fair enough! :) – erikvimz Dec 14 '17 at 18:12