You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[See a demo and examples here](http://jonthornton.github.com/jquery-timepicker)
7
+
8
+
jquery.timepicker is a lightweight timepicker plugin for jQuery inspired by Google Calendar. It supports both mouse and keyboard navigation, and weighs in at 2.5kb minified and gzipped.
9
+
10
+
Requirements
11
+
------------
12
+
*[jQuery](http://jquery.com/) (>= 1.7)
13
+
14
+
Usage
15
+
-----
16
+
17
+
```javascript
18
+
$('.some-time-inputs').timepicker(options);
19
+
```
20
+
21
+
```options``` is an optional javascript object with parameters explained below.
22
+
23
+
Options
24
+
-------
25
+
26
+
-**className**
27
+
A class name to apply to the HTML element that contains the timepicker dropdown.
28
+
*default: null*
29
+
30
+
-**minTime**
31
+
The time that should appear first in the dropdown list.
32
+
*default: 12:00am*
33
+
34
+
-**maxTime**
35
+
The time that should appear last in the dropdown list. Can be used to limit the range of time options.
36
+
*default: 24 hours after minTime*
37
+
38
+
-**showDuration**
39
+
Shows the relative time for each item in the dropdown. ```minTime``` or ```durationTime``` must be set.
40
+
*default: false*
41
+
42
+
-**durationTime**
43
+
The time against which ```showDuration``` will compute relative times.
44
+
*default: minTime*
45
+
46
+
-**step**
47
+
The amount of time, in minutes, between each item in the dropdown.
48
+
*default: 30*
49
+
50
+
-**timeFormat**
51
+
How times should be displayed in the list and input element. Uses [PHP's date() formatting syntax](http://php.net/manual/en/function.date.php).
52
+
*default: 'g:ia'*
53
+
54
+
-**scrollDefaultNow**
55
+
If no time value is selected, set the dropdown scroll position to show the current time.
56
+
*default: false*
57
+
58
+
-**scrollDefaultTime**
59
+
If no time value is selected, set the dropdown scroll position to show the time provided, e.g. "09:00".
60
+
*default: false*
61
+
62
+
-**selectOnBlur**
63
+
Update the input with the currently highlighted time value when the timepicker loses focus.
64
+
*default: false*
65
+
66
+
-**appendTo**
67
+
Override where the dropdown is appended.
68
+
Takes either a `string` to use as a selector, a `function` that gets passed the clicked input element as argument or a jquery `object` to use directly.
69
+
*default: "body"*
70
+
71
+
-**disableTouchKeyboard**
72
+
Disable the onscreen keyboard for touch devices.
73
+
*default: true*
74
+
75
+
-**closeOnWindowScroll**
76
+
Close the timepicker when the window is scrolled. (Replicates ```<select>``` behavior.)
77
+
*default: true*
78
+
79
+
-**disabledTimeRanges**
80
+
Disable selection of certain time ranges. Input is an array of time pairs, like ```[['3:00am', '4:30am'], ['5:00pm', '8:00pm']]``
81
+
*default: []*
82
+
83
+
-**lang**
84
+
Language constants used in the timepicker. Can override the defaults by passing an object with one or more of the following properties: decimal, mins, hr, hrs.
85
+
*default:* ```{
86
+
decimal: '.',
87
+
mins: 'mins',
88
+
hr: 'hr',
89
+
hrs: 'hrs'
90
+
}```
91
+
92
+
93
+
94
+
Methods
95
+
-------
96
+
97
+
-**getTime**
98
+
Get the time using a Javascript Date object, relative to today's date.
99
+
100
+
```javascript
101
+
$('#getTimeExample').timepicker('getTime');
102
+
```
103
+
104
+
You can get the time as a string using jQuery's built-in ```val()``` function:
105
+
106
+
```javascript
107
+
$('#getTimeExample').val();
108
+
```
109
+
110
+
-**getSecondsFromMidnight**
111
+
Get the time as an integer, expressed as seconds from 12am.
0 commit comments