Skip to content
This repository was archived by the owner on Sep 2, 2024. It is now read-only.

isDateDisabled is not working #84

Closed
erolabzait opened this issue May 15, 2021 · 1 comment
Closed

isDateDisabled is not working #84

erolabzait opened this issue May 15, 2021 · 1 comment

Comments

@erolabzait
Copy link

I cannot make isDateDisabled work with vanilla js.

I used the example from the docs.

  var pickerDisableWeekend = document.querySelector(".picker-disabled-weekend");
  var PICKER_DISABLED_DATE_FORMAT = /^(\d{4})-(\d{1,2})-(\d{1,2})$/

  pickerDisableWeekend.dateAdapter = {
    parse: function parse() {
      console.log('here 1');
      var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : "";
      var createDate = arguments.length > 1 ? arguments[1] : undefined;
      var matches = value.match(PICKER_DISABLED_DATE_FORMAT);
      if (matches) {
        return createDate(matches[3], matches[2], matches[1]);
      }
    },

    format: function format(date) {
      console.log('here 2');
      return ""
              .concat(date.getFullYear(), "-")
              .concat(date.getMonth() + 1, "-")
              .concat(date.getDate());
    },

    isDateDisabled: function isDateDisabled(date, focusedDay) {
      console.log('here 3');
      return (
        date.getDay() === 0 ||
        date.getDay() === 6 ||
        !(date.getFullYear() === focusedDay.getFullYear() && date.getMonth() === focusedDay.getMonth())
      );
    }
  };

In the browser console, i get only the log "here 2".
I used this version https://cdn.jsdelivr.net/npm/@duetds/[email protected]/dist/duet/duet.js

@WickyNilliams
Copy link
Contributor

That functionality has been merged to master, but not released yet. There were some outstanding tweaks/issues that needed doing first. See #80. I will release in the coming days

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants