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

115
Views
How to display number of sunday's between the dates on the ReactJS application

I'm trying build app on ReactJS to display number of Sundays between the dates when click on submit button. I've take start date and end date as input date and button in side a form. I'm unable to get an idea how to incorporate in submitHandler and display. Below is my code

 import React from 'react'
    import {useState} from 'react'
    
    const Calculate = () => {
      const [inputDate,setInputDate] = useState({
        sdate:'',
        edate:'',
      });
      
      const onChangeHandler = (e)=>{
          let name =e.target.name
          let value = e.target.value
    
    
        const Calculate = () => {
          const [inputDate,setInputDate] = useState({
            sdate:'',
            edate:'',
          });
          
          const onChangeHandler = (e)=>{
              let name =e.target.name
              let value = e.target.value
              setInputDate({...inputDate,[name]:value})
          }
          const submitHandler=(e)=>{
            e.preventDefault();
            
          }
    
          return (
            <div>
              <form action="">
                <div>
                  <div>
                    <label htmlFor="">Start Date</label>
                    <input type="date" name="sdate"  onChange={onChangeHandler}/>
                  </div>
                  <div>
                    <label htmlFor="">End Date</label>
                    <input type="date" name="edate" onChange={onChangeHandler}/>
                  </div>
                  <button>Submit</button>
                </div>
              </form>
            </div>
          )
        }
    
        export default Calculate
    
    <!-- end snippet -->
    
          setInputDate({...inputDate,[name]:value})
      }
      const submitHandler=(e)=>{
        e.preventDefault();
        
      }
    
      return (
        <div>
          <form action="">
            <div>
              <div>
                <label htmlFor="">Start Date</label>
                <input type="date" name="sdate"  onChange={onChangeHandler}/>
              </div>
              <div>
                <label htmlFor="">End Date</label>
                <input type="date" name="edate" onChange={onChangeHandler}/>
              </div>
              <button>Submit</button>
            </div>
          </form>
        </div>
      )
    }
    
    export default Calculate

Looking for help here. Thank you

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!