0

Edit --- This is how I made it work:

disableDayFn: function (date) {

    var dia = ('0' + date.getDate()).slice(-2);
    var mes = ('0' + (date.getMonth() + 1)).slice(-2);
    var ano = date.getFullYear();

    var dataFormatada = dia + '/' + mes + '/' + ano;

    if (dataFormatada == '08/12/2018') {
      return date;
    }

    if (dataFormatada == '25/12/2018') {
      return date;
    }

  }

I hope it helps anyone in the future!


I'm trying to disable holidays on materialize picker, but I have no idea on how to do so, could you please help?

The next holiday is on 20/11/2018 and then 28/11/2018, could you use it as exemple?

Thank you all!

<div class="row">
        <div class="input-field col s12">
          <input type="text" class="datepicker" id="vencimento">
          <label for="vencimento" class="active">Vencimento</label>
          <span class="helper-text">É necessário enviar a solicitação no mínimo cinco dias úteis antes do vencimento.</span>
        </div>
      </div>

 $('.datepicker').datepicker({
  i18n: {
    months: ['Janeiro', 'Fevereiro', 'Março', 'Abril', 'Maio', 'Junho', 'Julho', 'Agosto', 'Setembro', 'Outubro', 'Novembro', 'Dezembro'],
    monthsShort: ['Jan', 'Fev', 'Mar', 'Abr', 'Mai', 'Jun', 'Jul', 'Ago', 'Set', 'Out', 'Nov', 'Dez'],
    weekdays: ['Domingo', 'Segunda', 'Terça', 'Quarta', 'Quinta', 'Sexta', 'Sabádo'],
    weekdaysShort: ['Dom', 'Seg', 'Ter', 'Qua', 'Qui', 'Sex', 'Sab'],
    weekdaysAbbrev: ['D', 'S', 'T', 'Q', 'Q', 'S', 'S'],
    today: 'Hoje',
    clear: 'Limpar',
    cancel: 'Sair',
    done: 'Confirmar',
    labelMonthNext: 'Próximo mês',
    labelMonthPrev: 'Mês anterior',
    labelMonthSelect: 'Selecione um mês',
    labelYearSelect: 'Selecione um ano',
    selectMonths: true,
    selectYears: 15,
  },
  disableWeekends: true,
  format: 'dd/mm/yyyy',
  container: 'body',
  minDate: window.date.addDays(7),
});

This is how my code is, I'm translating it to PT-BR. What I need is to block some holidays, because this should be only work on work days. I checked that there is a function called disableDayFn, but I don't know how to use it properly.

Eddie
  • 1
  • 2
  • Hi Eddie! In order for us to assist you to our fullest extent, we need as much information or code relating to the problem as possible. In this case, it would be a big help if you provided us with a working https://codepen.io/ , https://jsfiddle.net/ or StackOverflow Code Sample of your problem. That way we can see the problem for ourselves, debug the issue, and provide you with a solution ASAP. :) – Gary Thomas Nov 16 '18 at 17:24
  • Hi Gary, thank you for you answer! I edit my code, thank you! – Eddie Nov 16 '18 at 17:39
  • i think you have to insert the days acording you necesites like this https://stackoverflow.com/questions/22065143/how-do-i-disable-public-holidays-in-a-jquery-ui-date-picker – Augusto Nov 16 '18 at 18:01
  • have you tried using "disableDayFn" function – Deepak Verma Nov 23 '18 at 13:12

0 Answers0