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

155
Views
Issue with a DateTimePicker and how to pass the date selected to another function?

I don't use often js script but to finish my project i need to resolve this issue. I'm using DateTimePicker from https://github.com/nehakadam/DateTimePicker .

After initialize the calendar, i can select a date and the date is showing in the calendar input. But after that i don't know how to retrieve and to send the date selected (for example 02-01-2021) to another script in further in my html file. I have a variable called :

var dataSource2 = "../testcanvas/data/Multi_band_01-01-2021.tif";

The date selected must change the dataSource2 variable (so in Multi_band_02-01-2021.tif).

Here is my code for the calendar:

        <script>

            $(document).ready(function()
                {$("#dtBox")
                .DateTimePicker({
                    addEventHandlers: function()
                    {
                        var dtPickerObj = this;

                        $("#datePicker .pickerButton").click(function(e)
                        {
                            dtPickerObj.on("change", function(e){ console.log(e.date); })
                            alert("test");
                        });                 
                    }
                });
            });

        </script>

None of the alert and the console.log is triggered. I don't know what the problem as this stage.

Thank you very much for your help !

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

ok i found a solution :

        <script type="text/javascript">
            var oDTP, dDate, dTime, dDateTime,
            sDateFormat = "";
            $(document).ready(function()
                {$("#dtBox")
                .DateTimePicker({

                    dateFormat: "dd-MM-yyyy",
                                                
                    buttonClicked: function(sButtonType, oElement)
                    {
                        oDTP = this;

                        if(sButtonType === "SET")
                        {
                            datex=oDTP.getDateTimeStringInFormat("Date", "dd-MM-yyyy");
                            var dataSource2="../testcanvas/data/Multi_band_"+datex+".tif";
                            updateChart(dataSource2)
                        }                                
                    }

                });
            });
        </script>

Thanks Caio Koiti for your help ! :)

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