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

146
Visualizações
Implement a datePicker using javascript

I am trying to implement a date picker on a field , code is shown below but it does not work. I have used Pikaday Javascript calender.

<div class="form-group">
                @Html.LabelFor(model => model.TimePeriod.EndDate, htmlAttributes: new { @class = "control-label col-md-8" })
                <div>
                    @Html.EditorFor(model => model.TimePeriod.EndDate, new { htmlAttributes = new { @class = "datepicker form-control"} })
                    @Html.ValidationMessageFor(model => model.TimePeriod.EndDate, "", new { @class = "text-danger" })
                </div>
                <script src="~/Scripts/pikaday.js"></script>
                <link href="~/Content/css/pikaday.css" rel="stylesheet" />
                <link href="~/Content/css/site.css" rel="stylesheet" />
                <link href="~/Content/css/theme.css" rel="stylesheet" />
                <link href="~/Content/css/triangle.css" rel="stylesheet" />
                <script type="text/javascript">
                    //var currentTime = new Date()
                    var picker = new Pikaday(
                        {
                            field: document.getElementById('EndDate'),
                            firstDay: 1,
                            minDate: new Date('2010-01-01'),
                            maxDate: new Date('2033-12-12'),
                            yearRange: [2010, 2033],
                            numberOfMonths: 1,
                            theme: 'dark-theme'
                        });
                </script>
            </div>
   
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

The id was missing for the Html attribute. After adding the id="EndDate" which Pikaday is using - It resolved the issue. @Html.EditorFor(model => model.TimePeriod.EndDate, new { htmlAttributes = new { @class = "datepicker form-control", @id="EndDate"} })

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