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

318
Visualizações
Select Month and Day only from UI .How to hide Year from DateTimePicker- Tempus Dominus Datetime Picker Bootstrap

I have a case there I want to select Month and Day from the UI to create recurring task.No need to select a year.28 days should be displayed in February.I am using Bootsrap for building the UI.I am initially thought of considering below option for implementing the same

  1. Create one Dropdown where All the Months will be displayed (ie Jan,Feb,Mar..Dec)

  2. Create another dropdown for loading Days.(1,2...31). This dropdown should be reloaded based on Month selection.

Is it possible to do the same using Tempus-Dominus Datetime picker ?? https://getdatepicker.com/5-4/

I have created sample fiddle .Where i want display similar like (Mar - 31) after selecting. Year should not be there in DateTimepicker.(By default consider Year as 2022.But it should not be displayed anywhere in Datetimepicker.)

      $('#datetimepicker1').datetimepicker({

       format: 'MM-DD'
    });

https://jsfiddle.net/8ck1tanb/1/

Can anyone suggest better user friendly design/approach for implementing this functionality. It will be more helpful if you can share sample code if it is already implemented.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can make use of the tempus-dominus-datetimepicker events to split the month and the year and show only the month.

Here is an example fiddle.

   $('#datetimepicker1').on('show.datetimepicker update.datetimepicker change.datetimepicker',function(){
     if(typeof $(this).find('.picker-switch').html() !== "undefined"){
       $(this).find('.picker-switch').html($(this).find('.picker-switch').html().split(" ")[0]);
     };    
   });
  • show.datetimepicker is triggered when the popup opens.
  • update.datetimepicker is triggered when you use the 'next' 'previous' arrows
  • change.datetimepicker is triggered when you select a date

UPDATE

This fiddle has the 29th of Febuary disabled for the next 3 leap years You can simply disable specific dates with the disabledDates option.

$('#datetimepicker1').datetimepicker({
    disabledDates: [new Date('2024-02-29'),new Date('2028-02-29'),new Date('2032-02-29')]
});
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