javascript - Change jQuery daterange picker to disallow a date range if it contains disabled dates -


i have created jquery date range picker. able select dates ranges , show them in textbox. need is, need disable dates , assign different classes dates.

e.g. must able give class april 2, class b april 4 etc. 

i have tried results got while googled nothing helped. trying pass dates , classes should assigned dates. class should assigned dates plus must have option enable or disable dates.

the next thing trying if there disabled date in between 2 dates, range cannot selected.

e.g. suppose want select april 2 april 7 , april 5 disabled date.  able select either april 2 april 4 or april 6 april 7. 

that means 1 range should selectable. please solve this.

please find fiddle here:

you have create 2 arrays, 1 maps css class each date want disabled class:date, , 1 maps css class date want give special class, , then:

  1. inside beforeshowday, check if date in disabled dates array, , if find it, use associated class , return false, example: [false,"classa"], if not , check in special array , return class true, else whatever doing right now.
  2. inside onselect, check if selected range includes of dates in array , act accordingly
  3. then in class:date array, can add class:date desire disabled own class, , code handle it

full working solution here.

notes:

  1. the code disables 22nd of april , 15th of may (try playing dates)
  2. the code gives special class 15th of april , 10th of may.
  3. the css class applies background-color on td, does't show properly, have modify picker's css do
  4. reference hepled me provide answer here

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -