Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap 3 DateTimepicker Display TimePicker first

I'm working with the datetimepicker found here:

http://eonasdan.github.io/bootstrap-datetimepicker/

Maybe the answer is right in front of me, but I can't find it. How do you default to showing the edit time screen first? I'm creating a time keeping app, and I'd rarely change the date, but usually change the time.

Thanks for any help!

like image 990
Jason McMains Avatar asked Jul 19 '15 15:07

Jason McMains


2 Answers

Ok, its a little hackey but based on the response here:

https://github.com/Eonasdan/bootstrap-datetimepicker/issues/840

i added

$(".datetimepicker").on 'dp.show', () -> $(document).find('.picker-switch a[data-action="togglePicker"]').click()

to my coffeescript. The Jquery equivalent would be

$(".pickthetime").on('dp.show', function(){
  $(document).find('.picker-switch a[data-action="togglePicker"]').click()
});

It sort of does what I'm looking for, but the slide motion makes it look kinda crappy. Any thoughts?

like image 136
Jason McMains Avatar answered Nov 05 '22 15:11

Jason McMains


My 2 cents

('#myDatetimepicker').datetimepicker({
        icons: {
            time: "icona-orologio",
        }
    }).on('dp.show', function(e){
        setTimeout(function(){
            $('.bootstrap-datetimepicker-widget').find('.icona-orologio').parent().click();
        }, 300);
    });
like image 24
Spomar Avatar answered Nov 05 '22 13:11

Spomar