How to set 24 hour format in TempusDominus?

552 Views Asked by At

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."

2

There are 2 best solutions below

0
Noob_Programmer On BEST ANSWER

This is the code to set 24hour format:

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

In ver 6.2.10 I set set 24 hour with:

localization: {
    startOfTheWeek: 1,
    format: 'yyyy-MM-dd HH:mm',
    hourCycle: 'h24'
},