JQuery UI DateTimepicker - can't hide time

I am using the date time picker component from http://trentrichardson.com/examples/timepicker/ . Trying to hide a timer, but my code does not work:

$('#id_start_date_time').datetimepicker('option', 'showTimepicker', false); 
+4
jquery datetimepicker timepicker
source share
7 answers

I just stumbled upon this problem. I know that some time has passed since the OP asked this question, and he probably solved the problem. Just for those who might run into this problem in the future, if you want to hide the timepicker, just just call the original jquery ui datepicker method

 datepicker() 

instead

 datetimepicker() 
+5
source share

timepicker: false for jquery.datetimepicker

+4
source share

I use this code when other code is not working.

  $('#datetimepicker_date_to_view').datetimepicker({ timepicker:false, format:'dmY', }).on('change', function() { $('.xdsoft_datetimepicker').hide(); var str = $(this).val(); str = str.split("."); $('#alt_date_field').val(str[2]+'-'+str[1]+'-'+str[0]); }); 
+4
source share

You need to add the following parameter:

timepicker: false

(timepicker must be lowercase)

+2
source share

You should define parameters like this:

 $('#id_start_date_time').datetimepicker({ showTimePicker: false }); 

To add additional parameters, you can simply separate with commas:

 $('#id_start_date_time').datetimepicker({ showTimePicker: false, showSecond: true, timeFormat: 'hh:mm:ss' }); 
+1
source share

I used 'showTimepicker': true, / 'showTimepicker': false, options for showing / hiding time parameters if they are not needed.

some pages have both with time and without time parameters, so I needed to use this option.

when I set to false, it hides the time parameters that it is intended to execute, but overide

 $.datepicker._base_gotoToday = $.datepicker._gotoToday; 

causes problems. When I click the Today / Now button, it sets the date today, but hides the calendar, and when I click on the input field, nothing happens, only when I click in another place and then click on the input field again, it shows the calendar.

I deleted the line

 $('.ui-datepicker-today', $dp).click(); 

which seems to have solved the problem.

He lost the ability to close when I click the Today button, but I can live with it

0
source share

this code works fine:

  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.min.css"> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.min.js"></script> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-datetimepicker/2.5.20/jquery.datetimepicker.full.min.js"></script> <input class="form-control" id="datetimepicker" type="text" name="date" placeholder="Date"> <script> $('#datetimepicker').datetimepicker({ format:'Ym-d',timepicker: false, }); </script> 

Also enable jquery library

0
source share

All Articles