Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

113
Views
Cómo deshabilitar todos los días del mes excepto el jueves de la segunda y cuarta semana en Kendodatepicker

Estoy usando kendodatepicker en formato HTML para seleccionar fechas. Quiero deshabilitar todas las fechas de cada mes y mostrar solo la segunda y cuarta semana el jueves solo para que sean seleccionables (significa que el usuario puede seleccionar solo 2 días en un mes que es jueves).

¿Cómo puedo lograr eso usando kendodatepicker? Busqué mucho en Internet pero no encontré nada útil.

actualmente, estoy usando la función para esto como:--

$("#datepicker").kendoDatePicker({ formato: "dd/MM/aaaa", min: ayer, disabledDates: ["mo","tu","we","sa","su","fr ",], });

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Una de las sobrecargas del método disabledDates es aceptar una función. Lo que puedes hacer es:

  1. Comprobar si la fecha es un jueves
  2. Comprobar si la fecha cae en la segunda o cuarta semana del mes
  3. Si uno y dos son verdaderos, devuelve falso

Aquí hay una función ingeniosa que obtiene la semana del mes para una fecha determinada para ayudar con el número 2: https://stackoverflow.com/a/36036273/1920035

Aquí hay un ejemplo:

 const getWeekOfMonth = (date) => { var firstWeekday = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1; if (firstWeekday < 0) { firstWeekday = 6; } var offsetDate = date.getDate() + firstWeekday - 1; return Math.floor(offsetDate / 7); }; $("#datepicker").kendoDatePicker({ value: new Date(), disableDates: (date) => { date = new Date(date); const dayOfWeek = date.getDay(); const weekOfMonth = getWeekOfMonth(date); return !(dayOfWeek === 4 && (weekOfMonth === 1 || weekOfMonth === 3)); } });
 <link rel="stylesheet" href="https://kendo.cdn.telerik.com/2022.1.301/styles/kendo.default-v2.min.css"/> <script src="https://code.jquery.com/jquery-1.12.4.min.js"></script> <script src="https://kendo.cdn.telerik.com/2022.1.301/js/kendo.all.min.js"></script> <input id="datepicker" />

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!