0

Hi is there a way i can block off certain hours in the anytime picker, so that the user wont be able to click on those hours. For example grey off the hours ( 19,20,21,22,23,00,01,02,03,04,05,06,07,08).

Im trying to create a UI for the user to block off after work hours.

Thanks

Azl
  • 5
  • 1
  • 5

1 Answers1

0

The picker currently doesn't provide such an option on a day-by-day basis. I'm working on a replacement library that will, but it is still many months from release.

Meanwhile, you can modify the code yourself to accomplish this, as follows:

Near line #3271 in anytime.5.0.5.js, find this:

$(this).AnyTime_current( hr == i,
  ((!_this.earliest)||(cmpHi.getTime()>=_this.earliest)) &&
    ((!_this.latest)||(cmpLo.getTime()<=_this.latest)) );

The second argument to AnyTime_current() determines whether the button can be selected. The variable i here is the hour represented by the button. Modify the argument to exclude your off-hours:

$(this).AnyTime_current( hr == i,
  ((!_this.earliest)||(cmpHi.getTime()>=_this.earliest)) &&
    ((!_this.latest)||(cmpLo.getTime()<=_this.latest)) &&
    ( i > 8 ) && ( i < 19 ) );

Please let me know whether it works for you.

Andrew M. Andrews III
  • 1,989
  • 18
  • 23
  • Sorry for the late reply. Thanks Andrew will give it a try. And thanks for the great ui! – Azl Jan 18 '15 at 17:49