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

148
Views
Problem with choosing the date type in js

What's wrong here? Tries to do that after clicking on input = date and selecting the date save method, it will print the selected entry under the button or (04/12/2000) or (April 12, 2000)

    <body>
        <input type="date" name="txtnum1" id="txtnum1"> <br>
        <select name="sztos" id="sztos" >
            <option value="op">12/04/2000</option>
            <option value="xd">12 kwietnia 2000</option>
        </select> <Br>
        <button>Oblicz</button>
           <div id="dataa"></div>
           <div id="dataaa"></div>
        <script>
                var nazwamiesiecy = ["styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"];
                var nazwadni = ["Niedziela", "Poniedziałek", "Wtorek", "Środa", "Czwartek", "Piątek", "Sobota"];
    
            
                let input = document.querySelector("input");
                let guzik = document.querySelector("button");
    
                guzik.addEventListener("click", () => {
                    let wybranaData = new Date(input.value);
    
                    if (!input.value) {
                        alert("Wprowadź datę");
                        return;
                    }
                 
                  });
    
                const select = document.querySelector('select');
                const para = document.querySelector('p');
                select.addEventListener('change', sztosiwo);
    
                function sztosiwo() {
                    const tak = select.value;
                }
    
                if (tak = '12/04/2000') {
                    document.getElementById("dataaa").innerHTML =  wybranaData.getDate() + "." + wybranaData.getMonth() + "." + wybranaData.getFullYear().toString();
                } else if (tak = '12 kwietnia 2000') {
                    document.getElementById("dataa").innerHTML =  wybranaData.getDate() + " " + nazwamiesiecy[wybranaData.getMonth()] + " " + wybranaData.getFullYear().toString() + " roku";
                }
    
        </script>
    </body>
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!