Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show only time picker in date range picker

I am using daterange picker i want show only timepicker but its not working following is the link which is i am using for reference.

$(function() {
    $('#single_cal4').daterangepicker({
		singleDatePicker: true,
        datePicker: false,
        timePicker: true,
 
    });
})

http://www.daterangepicker.com/

like image 661
dev1 Avatar asked Sep 08 '16 07:09

dev1


People also ask

How do I set the time on my dateTime picker?

It Seems simple. $('#startdatetime-from'). datetimepicker({ language: 'en', format: 'yyyy-MM-dd hh:mm' });

How do I hide DateRangePicker?

Go to http://www.daterangepicker.com/#events, Check hide event.

How do I restrict a date picker?

You can restrict the users from selecting a date within the particular range by specifying MinDate and MaxDate properties. The default value of MinDate property is 1/1/1920 and MaxDate property is 12/31/2120 . Dates that appears outside the minimum and maximum date range will be disabled (blackout).

How do I customize DateRangePicker?

The DateRangePicker is available for UI customization based on your application requirements. It can be achieved by using renderDayCell event that provides an option to customize each day cell on rendering. The following example disables the weekends of every month by using renderDayCell event.


2 Answers

$('#duration').daterangepicker({
            timePicker: true,
            timePicker24Hour: true,
            timePickerIncrement: 1,
            timePickerSeconds: true,
            locale: {
                format: 'HH:mm:ss'
            }
        }).on('show.daterangepicker', function (ev, picker) {
            picker.container.find(".calendar-table").hide();
        });
like image 169
James De Souza Avatar answered Nov 14 '22 01:11

James De Souza


If you want a range of time :

$(function() {
   $('#single_cal4').daterangepicker({
            timePicker : true,
            timePicker24Hour : true,
            timePickerIncrement : 1,
            timePickerSeconds : true,
            locale : {
                format : 'HH:mm:ss'
            }
        }).on('show.daterangepicker', function(ev, picker) {
            picker.container.find(".calendar-table").hide();
   });
})

If you want single time picker:

$(function() {
   $('#single_cal4').daterangepicker({
            timePicker : true,
            singleDatePicker:true,
            timePicker24Hour : true,
            timePickerIncrement : 1,
            timePickerSeconds : true,
            locale : {
                format : 'HH:mm:ss'
            }
        }).on('show.daterangepicker', function(ev, picker) {
            picker.container.find(".calendar-table").hide();
   });
})
like image 34
Jay Prakash Avatar answered Nov 14 '22 00:11

Jay Prakash