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

370
Views
¿Cómo puedo activar la fecha, el mes y el año en Air Datepicker (función onRenderCell)?

Quiero configurar un calendario de tal manera que muestre los años, meses y fechas en una matriz. Creo que esto debería funcionar en la función onRenderCell pero no lo entiendo completamente.

En AirDatepicker, los días del mes, 12 meses y una ventana de años se dibujan por separado. Los números del mes se muestran correctamente. No se muestran meses ni años.

mi html

 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> <link href="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/css/datepicker.min.css" rel="stylesheet" type="text/css"> <script src="https://cdnjs.cloudflare.com/ajax/libs/air-datepicker/2.2.3/js/datepicker.min.js"></script> </head> <body> <input type="text" id="datepicker"> <script src="main.js"></script> </body> </html>

mi js

 let days = [ "2022-4-15", "2022-5-3", "2022-4-1", "2021-2-20"]; $('#datepicker').datepicker({ onRenderCell: function (date, cellType) { new_date = date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); //all dates passive let disabled = true; //if the date is in the array, she becomes active if (cellType == 'day'){ disabled = days.indexOf(new_date) == -1 } //called but not working if (cellType == 'month' && disabled == false){ disabled = days.indexOf(new_date) == -1 } if (cellType == 'year' && disabled == false){ disabled = days.indexOf(new_date) == -1 } return {disabled: disabled} } });

Dime, ¿qué estoy haciendo mal exactamente? ¿Cómo hacer que al elegir meses se muestren aquellos que tienen las fechas deseadas?

about 4 years ago · Juan Pablo Isaza
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!