React Datepicker Enable Date Between A Range With Vanilla Js

React datepicker Dom manupulation

This Is An Example to Enable the datepicker Dates between the Specific starting date and end date throught javascript , this is the javascript code which runs on the console or the dom manupulation tools after the react dom will render , like if we are building up the specific usecase or activities in adobe target to Enable the dates between with the help of javascript we can use the below code to do so where we will pass the starting date and end date which will match with the react dates in react datepicker dom and only enables these dates, evenry this is aleary build only you need to pass the dom selector. startinmg date and end dates.

Suppose i want to Enables only the dates between 12Nov 2024 to 06dec 2024 so we will pass this dates as a variable wich will extract the date and the month in the and match it will the datepicker dom

Check out the below code

the class .search-widget-form-body__departure is the main container of the date picker and var months = document.querySelectorAll(“.rdrMonth”); check all the displaying month in date picker and var days = ele.querySelector(“.rdrDays”); are the dayes displaying in months, for each loop is implimented to match the dates.

Further reading

  • React UseEffect | simplifyScript

    Understanding the useEffect hook in React

    In this article, we will learn about another React hook called useEffect(), through this article you will be able to understand what is react useEffect Hook and how to use useEffect() hook in react, this is most communally used hook after useState() hook, we mostly use this hook in every component on react now first […]
  • React useState function

    How to Use useState Hook in React Application

     In a React application, normal vanilla JavaScript may not work for some concepts. For example, if I want to toggle a class on a button click or add and remove classes, I might need to show a popup on the website. This can be easily achieved in vanilla JavaScript using the element.classList.toggle(“newClass”) method, allowing us to add […]
  • javascript DOm manipulation - simplifyscript

    What is DOM manipulation in javascript 

    In this article, we will explore JavaScript DOM manipulation, a key feature of JavaScript that allows developers to modify the Document Object Model (DOM) of a webpage. DOM manipulation enables you to dynamically alter the content and structure of HTML documents. To grasp this concept thoroughly, we’ll start by defining what the DOM is and […]