Helen Araya
Helen Araya

Reputation: 1946

Bootstrap3 datetime picker 24Hours option not working

I am using bootstrap 3 datetime picker from the link in eonasdan.github but when I try to set an option for use24Hours I see a console error in line 1477 where key is the use24Hours?

 throw new TypeError('option ' + key + ' is not recognized!');

I am using version /*! version : 4.17.37 for bootstrap-datetimepicker.js

Here is how I am creating my datetime picker in javsacript.

("#mydiv").datetimepicker({ use24Hours: false });

I also tried small case for use24Hours as follows

("#mydiv").datetimepicker({ use24hours: false });

Based on the Answer that is the way to do it. What is wrong with mine?

Just as a note: I can't use format:HH:mm because I that would change the whole datetime picker to just use the time format. but what I want is to keep the date format as of the current language I selected fr,us...etc but alter the time as I want regardless of the culture.

Upvotes: 2

Views: 2810

Answers (1)

Matthew Mullin
Matthew Mullin

Reputation: 71

For those still looking for an answer, just change the format to HH:mm

$("#id").datetimepicker({
    format: 'DD/MM/YYYY HH:mm'
});

Note: I've also swapped the months and days around as that makes more sense to me

Upvotes: 6

Related Questions