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

313
Views
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 answers
Answer question

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 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!