From ddb380006c3a9626d3de9cdd62bd67f31f83c54a Mon Sep 17 00:00:00 2001 From: Girts Silis Date: Thu, 6 Mar 2014 16:31:10 -0500 Subject: [PATCH] Examples for beforeShowDay callback in index.html --- index.html | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/index.html b/index.html index 2fd1924..9bd0d5c 100644 --- a/index.html +++ b/index.html @@ -3,6 +3,13 @@ +

Homepage

@@ -34,6 +41,12 @@ +

Disable Specific Dates

+

Disable the dates 2 days from now.

+ +

Custom Date Styling

+

Make the background of the date 2 days from now bright red.

+ @@ -120,5 +133,27 @@ $('#datetimepicker9').datetimepicker({ weekends:['01.01.2014','02.01.2014','03.01.2014','04.01.2014','05.01.2014','06.01.2014'], timepicker:false }); +var dateToDisable = new Date(); + dateToDisable.setDate(dateToDisable.getDate() + 2); +$('#datetimepicker11').datetimepicker({ + beforeShowDay: function(date) { + if (date.getMonth() == dateToDisable.getMonth() && date.getDate() == dateToDisable.getDate()) { + console.log("Disable date " + date.toDateString()); + return [false, ""] + } + + return [true, ""]; + } +}); +$('#datetimepicker12').datetimepicker({ + beforeShowDay: function(date) { + if (date.getMonth() == dateToDisable.getMonth() && date.getDate() == dateToDisable.getDate()) { + console.log("Style date " + date.toDateString()); + return [true, "custom-date-style"]; + } + + return [true, ""]; + } +});