Calculation of the datepicker calendar



  • Can a certain date be distinguished in the calendar datepicker through js and, for example, another colour of the text?
    введите сюда описание изображения


    This is an example in the picture, but it's not a series, it's a date.
    Note: The dark blue is given the current date, and an additional date is required with its allocation (colour example )



  • I'm guessing yesterday's date might be something like that.

    let d = new Date();
    let yts = d.setHours(0,0,0,0) -  24*3600*1000;
    

    $("#datepicker" ).datepicker({
    beforeShowDay: function(d){
    if(d.getTime() == yts){
    return [true, 'wow', 'hey!'];
    }
    return [true];
    }
    });

    .wow > a {

    color: red !important;
    }

    <link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
    <script src="https://code.jquery.com/jquery-3.6.0.js"></script>
    <script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>

    <input type="text" id="datepicker">



Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2