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
var picker =newLightpick({ field:document.getElementById('datepicker') });
46
+
<scriptsrc="lightpick.js"></script>
47
+
<script>
48
+
var picker =newLightpick({ field:document.getElementById('datepicker') });
49
49
</script>
50
50
```
51
51
@@ -55,13 +55,13 @@ var picker = new Lightpick({ field: document.getElementById('datepicker') });
55
55
56
56
### field
57
57
- Type: `Element`
58
-
- Default: `null`
58
+
- Default: `null`
59
59
60
60
Bind the datepicker to a form field
61
61
62
62
### secondField
63
63
- Type: `Element`
64
-
- Default: `null`
64
+
- Default: `null`
65
65
66
66
If exists then end of date range will set here.
67
67
@@ -73,7 +73,7 @@ ISO day of the week (1: Monday, ..., 7: Sunday).
73
73
74
74
### parentEl
75
75
- Type: `String`
76
-
- Default: `body`
76
+
- Default: `body`
77
77
78
78
Selector of the parent element that the date range picker will be added to, if not provided this will be 'body'.
79
79
@@ -107,6 +107,12 @@ Number of visible months.
107
107
108
108
Number of columns months.
109
109
110
+
### preventCollapse
111
+
- Type: `Boolean`
112
+
- Default: `false`
113
+
114
+
Prevent collapsing to single month on devices with screen smaller than 480px wide.
115
+
110
116
### singleDate
111
117
- Type: `Boolean`
112
118
- Default: `true`
@@ -201,7 +207,7 @@ Calc date range in nights. (For hotels when last date doesn't include to range)
201
207
- Type: `String`
202
208
- Default: `auto`
203
209
204
-
A space-separated string consisting of one or two of “left” or “right”, “top” or “bottom”, and “auto” (may be omitted); for example, “top left”, “bottom” (horizontal orientation will default to “auto”), “right” (vertical orientation will default to “auto”), “auto top”.
210
+
A space-separated string consisting of one or two of “left” or “right”, “top” or “bottom”, and “auto” (may be omitted); for example, “top left”, “bottom” (horizontal orientation will default to “auto”), “right” (vertical orientation will default to “auto”), “auto top”.
205
211
206
212
### disableWeekends
207
213
- Type: `Boolean`
@@ -217,52 +223,52 @@ Show calendar inline. If `true` and `parentEl` is not provided then will use `pa
217
223
218
224
### dropdowns
219
225
- Type: `Object|Boolean`
220
-
- Default:
226
+
- Default:
221
227
```
222
-
{
223
-
years: {
224
-
min: 1900,
225
-
max: null,
226
-
},
227
-
months: true,
228
+
{
229
+
years: {
230
+
min: 1900,
231
+
max: null,
232
+
},
233
+
months: true,
228
234
}
229
235
```
230
-
Dropdown selections for years, months. Can be `false` for disable both dropdowns.
231
-
`years`_(Object|Boolean)_ - Object must contains `min` and `max` range of years or can be `false` for disable dropdown of years.
232
-
`months`_(Boolean)_ - `true/false` for enable/disable dropdown of months.
236
+
Dropdown selections for years, months. Can be `false` for disable both dropdowns.
237
+
`years`_(Object|Boolean)_ - Object must contains `min` and `max` range of years or can be `false` for disable dropdown of years.
238
+
`months`_(Boolean)_ - `true/false` for enable/disable dropdown of months.
233
239
234
240
235
241
### locale
236
242
- Type: `Object`
237
-
- Default:
243
+
- Default:
238
244
```
239
-
{
240
-
buttons: {
241
-
prev: '←',
242
-
next: '→',
243
-
close: '×',
244
-
reset: 'Reset',
245
+
{
246
+
buttons: {
247
+
prev: '←',
248
+
next: '→',
249
+
close: '×',
250
+
reset: 'Reset',
245
251
apply: 'Apply'
246
-
},
247
-
tooltip: {
248
-
one: 'day',
252
+
},
253
+
tooltip: {
254
+
one: 'day',
249
255
other: 'days'
250
256
},
251
257
tooltipOnDisabled: null,
252
258
pluralize: function(i, locale){
253
259
if (typeof i === "string") i = parseInt(i, 10);
254
-
260
+
255
261
if (i === 1 && 'one' in locale) return locale.one;
256
262
if ('other' in locale) return locale.other;
257
-
263
+
258
264
return '';
259
265
}
260
266
}
261
267
```
262
-
`buttons` - Text for buttons
263
-
`tooltip` - Text for tooltip (one, few, many, other)
264
-
`tooltipOnDisabled` (String) - Show tooltip text on disabled dates. (Eg. «Already booked»)
265
-
`pluralize` (function) - Function for calc plural text. More examples for another locales on [betsol/numerous](https://github.com/betsol/numerous/tree/master/locales)
268
+
`buttons` - Text for buttons
269
+
`tooltip` - Text for tooltip (one, few, many, other)
270
+
`tooltipOnDisabled` (String) - Show tooltip text on disabled dates. (Eg. «Already booked»)
271
+
`pluralize` (function) - Function for calc plural text. More examples for another locales on [betsol/numerous](https://github.com/betsol/numerous/tree/master/locales)
266
272
267
273
### onSelect
268
274
- Type: `Function`
@@ -287,23 +293,23 @@ Callback function for when the picker is hidden.
287
293
- Default: `null`
288
294
289
295
Working when `disabledDatesInRange: false`
290
-
Callback function for when user has select date range with disabled dates.
296
+
Callback function for when user has select date range with disabled dates.
291
297
292
298
## Methods
293
299
294
300
* * *
295
301
296
302
### picker.setDate(date)
297
303
298
-
Set date when singleDate is true. `date` can be moment, string, number, date.
304
+
Set date when singleDate is true. `date` can be moment, string, number, date.
299
305
Eg. `picker.setDate(new Date());`
300
306
301
-
307
+
302
308
### picker.setDateRange(start, end)
303
309
304
-
Set date range. <code>start, end</code> can be moment, string, number, date.
310
+
Set date range. <code>start, end</code> can be moment, string, number, date.
0 commit comments