Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

265
Vistas
How to use enable and disable properties together in flatpickr.js?

I am unable to use enable and disable properties together in flatpickr.js. Actually enable property is returning a range of dates that should be enabled but I want to disable specific days let's say weekends among those enabled days range.

datePickerInput.flatpickr({
                    clickOpens: false,
                    disableMobile: 'true', // Do not render mobile version UI
                    closeOnSelect: false,
                    defaultDate: null,
                    enable: [getEnableDays()],
                    disable: [
                        function (date) {
                            return (date.getDay() === 0 || date.getDay() === 6);
                        }
                    ],
                    locale: {
                        "firstDayOfWeek": 1 
                    }
                });
getEnableDays: function () {
        var me = this;
        var maxDate = '2090-12-25T16:16:22.585Z';
        var minDate = '1900-12-24T16:16:22.585Z';
        var fromDate = minDate;
        var toDate = maxDate;
        if (me.disableDays) {
            fromDate = me.isPrevDaysDisable ? me.calculatedDate.toISOString().slice(0, 10) : 'today';
            toDate = !me.isPrevDaysDisable ? me.calculatedDate.toISOString().slice(0, 10) : 'today';
        }
        return {
            from: fromDate,
            to: toDate,
        };
    },
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can't use disable along with enable but here's how you can achieve disable weekends functionality but using onDayCreate.

onDayCreate: function (dObj, dStr, fp, dayElem) {
                        if (dayElem.dateObj.getDay() === 0 || dayElem.dateObj.getDay() === 6) {
                            dayElem.className += " flatpickr-disabled nextMonthDayflatpickr-disabled";
                        }
                    },
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda