Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

152
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda