Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

153
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda