I am using bootstrap datepicker.I need to highlight some random dates.
For Example:
I need to highlight the dates like 1,3,8,20,21,16,26,30. Could you please tell me how to highlight those random dates in bootstrap datepicker?
I am using bootstrap datepicker.I need to highlight some random dates.
For Example:
I need to highlight the dates like 1,3,8,20,21,16,26,30. Could you please tell me how to highlight those random dates in bootstrap datepicker?
I found a solution.
Only one problem there the highlights are removed on click. and it take month as one less. if you want August dates then you have to use 7 not 8.
Based on @Hassan Raza answer's I've made this jsfiddle: https://jsfiddle.net/ToniBCN/mzke8tuv/
Set calendar to february 2019 to see some days in orange, others in green and the rest disabled, depending json data.
The Blog post here explaining how it can achieve using Bootstrap Datetimepicker.
Basically using the events show, update and change the date need to be highlighted.
For more information see the blog
Reference:
https://scode7.blogspot.com/2019/04/here-is-code-function-hilight-var.html
As suggested by amphetamachine Highlight certain dates on bootstrap-datepicker provides most of what is required to solve this. The answer to that question can be adapted to the following
The above will apply the highlight style class to the listed days in every month, with further checks you could limit it to specific months. Some old browsers may not support indexOf, in which case you can either use a JS library or expand the if.
this is how i am highlighting all days except the days in "user_busy_days" array.
Bootstrap date-picker has beforeShowDay prop, which gets executed for each day of month [42 times max], so i just check if the day which is being rendered is in my array , and if it is present in array i highlight it with a gray color else i just highlight it with green color .
I hope it will do the trick.