javascriptcalendartempus-dominus-datetimepicker

How to set 24 hour format in TempusDominus?


How to set 24 hour format in TempusDominus?

    tempusDominus.TempusDominus(document.getElementById('datetimepicker'), {
        format: 'DD.MM.YYYY, HH:mm',
        display: {
            components: {
                clock: true,
            }
        }
     });

If I add a format, I get an error: "Error: TD:: ".format" in not a known option."


Solution

  • This is the code to set 24hour format:

               const pick1 =new tempusDominus.TempusDominus(document.getElementById('datetimepicker2'),{
                  display: {
                components: {
                useTwentyfourHour: true,
                          }
                      }
                  });;