Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing bugs with dynamically change enabled dates #125

Merged
merged 1 commit into from
Sep 19, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/zebra_datepicker.src.js
Original file line number Diff line number Diff line change
Expand Up @@ -640,6 +640,8 @@
// parse the rules for disabling dates and turn them into arrays of arrays

custom_class_names = [];
disabled_dates = [];
enabled_dates = [];
for (k in plugin.settings.custom_classes) if (plugin.settings.custom_classes.hasOwnProperty(k) && custom_class_names.indexOf(k) === -1) custom_class_names.push(k);

// it's the same logic for preparing the enabled/disable dates, as well as dates that have custom classes
Expand Down Expand Up @@ -911,7 +913,7 @@
for (var interval in disabled_dates)

// only if there is a rule that disables *everything*
if (disabled_dates[interval][0] === '*' && disabled_dates[interval][1] === '*' && disabled_dates[interval][2] === '*' && disabled_dates[interval][3] === '*') {
if ($.inArray('*', disabled_dates[interval][0]) > -1 && $.inArray('*', disabled_dates[interval][1]) > -1 && $.inArray('*', disabled_dates[interval][2]) > -1 && $.inArray('*', disabled_dates[interval][3]) > -1) {

var tmpDates = [];

Expand Down