@wernfried/daterangepicker 4.0.0 → 4.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,4 +1,846 @@
1
1
  # Date Range Picker
2
2
 
3
- This package has been moved to https://www.npmjs.com/package/@wernfried/daterangepicker
3
+ ![Daterangepicker Exsample](example/default-style.png)
4
+
5
+ This date range picker component creates a dropdown menu from which a user can
6
+ select a range of dates.
7
+
8
+ Features include limiting the selectable date range, localizable strings and date formats,
9
+ a single date picker mode, a time picker, and predefined date ranges.
10
+
11
+ ### [Documentation and Live Usage Examples](http://www.daterangepicker.com)
12
+
13
+ ### [See It In a Live Application](https://awio.iljmp.com/5/drpdemogh)
14
+
15
+ Above samples are based on the [original repository](https://github.com/dangrossman/daterangepicker) from Dan Grossman. [New features](#Features) from this fork are not available in these samples.
16
+
17
+ ## Basic usage
18
+
19
+ #### Global import with `<script>` tags
20
+ ```html
21
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
22
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
23
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.14.5/dist/global/daterangepicker.min.js"></script>
24
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.14.5/css/daterangepicker.min.css" rel="stylesheet" />
25
+
26
+ <input type="text" id="picker" />
27
+
28
+ <script type="text/javascript">
29
+ const DateTime = luxon.DateTime;
30
+
31
+ $(function() {
32
+ $('#picker').daterangepicker({
33
+ startDate: DateTime.now().plus({day: 1})
34
+ });
35
+ });
36
+ </script>
37
+ ```
38
+
39
+ #### ESM Imports
40
+ ```html
41
+ <script type="importmap">
42
+ {
43
+ "imports": {
44
+ "jquery": "https://cdn.jsdelivr.net/npm/jquery@4.0.0/+esm",
45
+ "luxon": "https://cdn.jsdelivr.net/npm/luxon@3.7.2/+esm",
46
+ "daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.14.5/+esm"
47
+ }
48
+ }
49
+ </script>
50
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.14.5/css/daterangepicker.min.css" rel="stylesheet" />
51
+
52
+ <input type="text" id="picker" />
53
+
54
+ <script type="module">
55
+ import { $ } from 'jquery';
56
+ import { DateTime } from 'luxon';
57
+ import DateRangePicker from 'daterangepicker';
58
+
59
+ $(function() {
60
+ $('#picker').daterangepicker({
61
+ startDate: DateTime.now().plus({day: 1})
62
+ });
63
+ });
64
+ </script>
65
+ ```
66
+
67
+ #### Style with Bulma
68
+ ```html
69
+ <script ...></script>
70
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/bulma@1.0.4/css/bulma.min.css" rel="stylesheet" />
71
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.14.5/css/daterangepicker.bulma.min.css" rel="stylesheet" />
72
+
73
+ <input type="text" id="picker" />
74
+
75
+ <script type="text/javascript">
76
+ $(function() {
77
+ $('#picker').daterangepicker({
78
+ externalStyle: 'bulma'
79
+ });
80
+ });
81
+ </script>
82
+ ```
83
+
84
+ #### Use of `data-*` attributes
85
+ ```html
86
+ <script ...></script>
87
+ <input type="text" id="picker" data-start-date="2026-02-01" data-end-date="2026-02-20" data-show-week-numbers="true" />
88
+
89
+ <script type="text/javascript">
90
+ $(function() {
91
+ $('#picker').daterangepicker();
92
+ });
93
+ </script>
94
+ ```
95
+ See [HTML5 data-* Attributes](https://api.jquery.com/data/#data-html5)<br/>
96
+ Options in `daterangepicker({...})` take precedence over `data-*` attributes.
97
+
98
+
99
+
100
+ ## Examples
101
+ ### `ranges`
102
+ <a name="options-ranges"></a>
103
+ ```js
104
+ range: {
105
+ 'Today': [DateTime.now().startOf('day'), DateTime.now().endOf('day')],
106
+ 'Yesterday': [DateTime.now().startOf('day').minus({day: 1}), DateTime.now().endOf('day').minus({day: 1})],
107
+ 'Last 7 Days': ['2025-03-01', '2025-03-07'],
108
+ 'Last 30 Days': [new Date(new Date - 1000*60*60*24*30), new Date()],
109
+ 'This Month': [DateTime.now().startOf('month'), DateTime.now().endOf('month')],
110
+ 'Last Month': [DateTime.now().minus({month: 1}).startOf('month'), DateTime.now().minus({month: 1}).endOf('month')]
111
+ },
112
+ alwaysShowCalendars: true
113
+ ```
114
+
115
+ ### `isInvalidDate`
116
+ ```js
117
+ isInvalidDate: function(date) {
118
+ return date.isWeekend;
119
+ }
120
+ ```
121
+
122
+ ### `isInvalidTime`
123
+ ```js
124
+ isInvalidTime: (time, side, unit) => {
125
+ if (unit == 'hour') {
126
+ return time.hour >= 10 && time.hour <= 14; // Works also with 12-hour clock
127
+ } else {
128
+ return false;
129
+ }
130
+ }
131
+ ```
132
+
133
+ ### `isCustomDate`
134
+ ```js
135
+ .daterangepicker-bank-day {
136
+ color: red;
137
+ }
138
+ .daterangepicker-weekend-day {
139
+ color: blue;
140
+ }
141
+
142
+ isCustomDate: function(date) {
143
+ if (date.isWeekend)
144
+ return 'daterangepicker-weekend-day';
145
+
146
+ const yyyy = date.year;
147
+ let bankDays = [
148
+ DateTime.fromObject({ year: yyyy, month: 1, day: 1 }), // New year
149
+ DateTime.fromObject({ year: yyyy, month: 7, day: 4 }), // Independence Day
150
+ DateTime.fromObject({ year: yyyy, month: 12, day: 25 }) // Christmas Day
151
+ ];
152
+ return bankDays.some(x => x.hasSame(date, 'day')) ? 'daterangepicker-bank-day' : '';
153
+ }
154
+ ```
155
+ ### Features
156
+ Compared to [inital repository](https://github.com/dangrossman/daterangepicker), this fork added following features and changes:
157
+
158
+ - Replaced [moment](https://momentjs.com/) by [luxon](https://moment.github.io/luxon/index.html) (see differences below)
159
+ - Added option `weekendClasses`, `weekendDayClasses`, `todayClasses` to highlight weekend days or today, respectively
160
+ - Added option `timePickerStepSize` to succeed options `timePickerIncrement` and `timePickerSeconds`
161
+ - Added events `dateChange.daterangepicker` and `timeChange.daterangepicker` emitted when user clicks on a date/time
162
+ - Added event `beforeHide.daterangepicker` enables you to keep the picker visible after click on `Apply` or `Cancel` button.
163
+ - Added event `beforeRenderTimePicker.daterangepicker` and `beforeRenderCalendar.daterangepicker` emitted before elements are rendered
164
+ - Added event `violated.daterangepicker` emitted when user input is not valid
165
+ - Added method `setRange(startDate, endDate)` to combine `setStartDate(startDate)` and `setEndDate(endDate)`
166
+ - Added option `minSpan` similar to `maxSpan`
167
+ - Added option `isInvalidTime` similar to `isInvalidDate`
168
+ - Added option `altInput` and `altFormat` to provide an alternative output element for selected date value
169
+ - Added option `onOutsideClick` where you can define whether picker shall apply or revert selected value
170
+ - Added option `initalMonth` to show datepicker without an initial date
171
+ - Added option `singleMonthView` to show single month calendar, useful for shorter ranges
172
+ - Better validation of input parameters, errors are logged to console
173
+ - Highlight range in calendar when hovering over pre-defined ranges
174
+ - Option `autoUpdateInput` defines whether the attached `<input>` element is updated when the user clicks on a date value.<br/>
175
+ In original daterangepicker this parameter defines whether the `<input>` is updated when the user clicks on `Apply` button.
176
+ - Added option `locale.durationFormat` to show customized label for selected duration, e.g. `'4 Days, 6 Hours, 30 Minutes'`
177
+ - Added option `externalStyle` to use daterangepicker with external CSS Frameworks. Currently only [Bulma](https://bulma.io/) is supported<br/>
178
+ but other frameworks may be added in future releases
179
+ - ... and maybe some new bugs 😉
180
+
181
+ ### Localization
182
+ All date values are based on [luxon](https://moment.github.io/luxon/index.html#/intl) which provides great support for localization. Instead of providing date format, weekday and month names manually as strings, it is usually easier to set the default locale like this:
183
+ ```js
184
+ $(function () {
185
+ const Settings = luxon.Settings;
186
+ Settings.defaultLocale = 'fr-CA'
187
+
188
+ $('#picker').daterangepicker({
189
+ timePicker: true,
190
+ singleDatePicker: false
191
+ };
192
+ });
193
+
194
+ ```
195
+ instead of
196
+ ```js
197
+ $(function () {
198
+ $('#picker').daterangepicker({
199
+ timePicker: true,
200
+ singleDatePicker: false,
201
+ locale: {
202
+ format: 'yyyyy-M-d H h m',
203
+ daysOfWeek: [ 'lun.', 'mar.', 'mer.', 'jeu.', 'ven.', 'sam.', 'dim.' ],
204
+ monthNames: [ "janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre" ],
205
+ firstDay: 7
206
+ }
207
+ };
208
+ });
209
+
210
+ ```
211
+
212
+ ### Style and themes
213
+
214
+ You can style this daterangepicker with [Bulma CSS Framework](https://bulma.io/). Light and dark theme is supported:
215
+
216
+ ![Bulma dark example](example/bulma-dark.png)
217
+
218
+ ![Bulma light example](example/bulma-light.png)
219
+
220
+
221
+ ## Methods
222
+
223
+ Available methods are listed below in [API documentation](#DateRangePicker). You will mainly use
224
+ * [.daterangepicker(options, callback)](#DateRangePicker.daterangepicker)
225
+ * [.setStartDate(startDate)](#DateRangePicker+setStartDate)
226
+ * [.setEndDate(endDate)](#DateRangePicker+setEndDate)
227
+ * [.setPeriod(startDate, endDate)](#DateRangePicker+setPeriod)
228
+ * `$(...).data('daterangepicker')` to get the daterangepicker object
229
+
230
+ all other methods are used rarely.
231
+
232
+ ### Differences between `moment` and `luxon` library
233
+ This table lists a few important differences between datarangepicker using moment and luxon. Check them carefully when you migrate from older daterangepicker.
234
+
235
+ | Parameter | moment | luxon |
236
+ | ----------------------- | --------------------------------------------------- | ----------------- |
237
+ | `locale.daysOfWeek` | [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ] | [ "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" ] |
238
+ | `locale.firstDay` | 0-6 (Sunday to Saturday) | 1 for Monday through 7 for Sunday |
239
+ | to ISO-8601 String | `toISOString()` | `toISO()` |
240
+ | to [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) Object | `toDate()` | `toJSDate()` |
241
+ | from ISO-8601 String | `moment(...)` | `DateIme.fromISO(...)` |
242
+ | from [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) Object | `moment(...)` | `DateIme.fromJSDate(...)` |
243
+ | current day | `moment()` | `DateTime.now()` |
244
+ | format to string | `format(...)` | `toFormat(...)` |
245
+ | format tokens | `'YYYY-MM-DD'` | `'yyyy-MM-dd'` |
246
+
247
+
248
+ ## License
249
+
250
+ The MIT License (MIT)
251
+
252
+ Copyright (c) 2012-2019 Dan Grossman<br/>
253
+ Copyright (c) 2025 Wernfried Domscheit
254
+
255
+ Licensed under the [MIT license](LICENSE).
256
+
257
+ # API Documentation
258
+ ## Classes
259
+
260
+ <dl>
261
+ <dt><a href="#DateRangePicker">DateRangePicker</a></dt>
262
+ <dd></dd>
263
+ </dl>
264
+
265
+ ## Events
266
+
267
+ <dl>
268
+ <dt><a href="#event_violated.daterangepicker">"violated.daterangepicker" (this, result)</a> ⇒ <code>boolean</code></dt>
269
+ <dd><p>Emitted if the input values are not compliant to all constraints</p>
270
+ </dd>
271
+ <dt><a href="#event_beforeRenderCalendar.daterangepicker">"beforeRenderCalendar.daterangepicker" (this)</a></dt>
272
+ <dd><p>Emitted before the calendar is rendered.
273
+ Useful to remove any manually added elements.</p>
274
+ </dd>
275
+ <dt><a href="#event_beforeRenderTimePicker.daterangepicker">"beforeRenderTimePicker.daterangepicker" (this)</a></dt>
276
+ <dd><p>Emitted before the TimePicker is rendered.
277
+ Useful to remove any manually added elements.</p>
278
+ </dd>
279
+ <dt><a href="#event_show.daterangepicker">"show.daterangepicker" (this)</a></dt>
280
+ <dd><p>Emitted when the picker is shown</p>
281
+ </dd>
282
+ <dt><a href="#event_beforeHide.daterangepicker">"beforeHide.daterangepicker" (this)</a> ⇒ <code>boolean</code></dt>
283
+ <dd><p>Emitted before the picker will hide. When EventHandler returns <code>true</code>, then picker remains visible</p>
284
+ </dd>
285
+ <dt><a href="#event_hide.daterangepicker">"hide.daterangepicker" (this)</a></dt>
286
+ <dd><p>Emitted when the picker is hidden</p>
287
+ </dd>
288
+ <dt><a href="#event_outsideClick.daterangepicker">"outsideClick.daterangepicker" (this)</a></dt>
289
+ <dd><p>Emitted when user clicks outside the picker.
290
+ Use option <code>onOutsideClick</code> to define the default action, then you may not need to handle this event.</p>
291
+ </dd>
292
+ <dt><a href="#event_showCalendar.daterangepicker">"showCalendar.daterangepicker" (this)</a></dt>
293
+ <dd><p>Emitted when the calendar(s) are shown.
294
+ Only useful when <a href="#Ranges">Ranges</a> are used.</p>
295
+ </dd>
296
+ <dt><a href="#event_hideCalendar.daterangepicker">"hideCalendar.daterangepicker" (this)</a></dt>
297
+ <dd><p>Emitted when the calendar(s) are hidden.
298
+ Only useful when <a href="#Ranges">Ranges</a> are used.</p>
299
+ </dd>
300
+ <dt><a href="#event_dateChange.daterangepicker">"dateChange.daterangepicker" (this, side)</a></dt>
301
+ <dd><p>Emitted when the date changed. Does not trigger when time is changed,
302
+ use <a href="#event_timeChange.daterangepicker">&quot;timeChange.daterangepicker&quot;</a> to handle it</p>
303
+ </dd>
304
+ <dt><a href="#event_apply.daterangepicker">"apply.daterangepicker" (this)</a></dt>
305
+ <dd><p>Emitted when the <code>Apply</code> button is clicked, or when a predefined <a href="#Ranges">Ranges</a> is clicked</p>
306
+ </dd>
307
+ <dt><a href="#event_cancel.daterangepicker">"cancel.daterangepicker" (this)</a></dt>
308
+ <dd><p>Emitted when the <code>Cancel</code> button is clicked</p>
309
+ </dd>
310
+ <dt><a href="#event_timeChange.daterangepicker">"timeChange.daterangepicker" (this, side)</a></dt>
311
+ <dd><p>Emitted when the time changed. Does not trigger when date is changed</p>
312
+ </dd>
313
+ <dt><a href="#event_inputChanged.daterangepicker">"inputChanged.daterangepicker" (this)</a></dt>
314
+ <dd><p>Emitted when the date is changed through <code>&lt;input&gt;</code> element. Event is only triggered when date string is valid and date value has changed</p>
315
+ </dd>
316
+ </dl>
317
+
318
+ ## Typedefs
319
+
320
+ <dl>
321
+ <dt><a href="#Options">Options</a></dt>
322
+ <dd><p>Options for DateRangePicker</p>
323
+ </dd>
324
+ <dt><a href="#Ranges">Ranges</a> : <code>Object</code></dt>
325
+ <dd><p>A set of predefined ranges</p>
326
+ </dd>
327
+ <dt><a href="#Range">Range</a> : <code>Object</code></dt>
328
+ <dd><p>A single predefined range</p>
329
+ </dd>
330
+ <dt><a href="#InputViolation">InputViolation</a> : <code>Object</code></dt>
331
+ <dd></dd>
332
+ <dt><a href="#callback">callback</a> : <code>function</code></dt>
333
+ <dd></dd>
334
+ </dl>
335
+
336
+ <a name="DateRangePicker"></a>
337
+
338
+ ## DateRangePicker
339
+ **Kind**: global class
340
+
341
+ * [DateRangePicker](#DateRangePicker)
342
+ * [new DateRangePicker(element, options, cb)](#new_DateRangePicker_new)
343
+ * _instance_
344
+ * [.setStartDate(startDate, isValid)](#DateRangePicker+setStartDate)
345
+ * [.setEndDate(endDate, isValid)](#DateRangePicker+setEndDate)
346
+ * [.setPeriod(startDate, endDate, isValid)](#DateRangePicker+setPeriod)
347
+ * [.validateInput([range])](#DateRangePicker+validateInput) ⇒ <code>Array</code> \| <code>null</code>
348
+ * [.updateView()](#DateRangePicker+updateView)
349
+ * [.show()](#DateRangePicker+show)
350
+ * [.hide()](#DateRangePicker+hide)
351
+ * [.toggle()](#DateRangePicker+toggle)
352
+ * [.showCalendars()](#DateRangePicker+showCalendars)
353
+ * [.hideCalendars()](#DateRangePicker+hideCalendars)
354
+ * [.updateElement()](#DateRangePicker+updateElement)
355
+ * [.updateAltInput()](#DateRangePicker+updateAltInput)
356
+ * [.remove()](#DateRangePicker+remove)
357
+ * _static_
358
+ * [.daterangepicker(options, callback)](#DateRangePicker.daterangepicker) ⇒
359
+
360
+ <a name="new_DateRangePicker_new"></a>
361
+
362
+ ### new DateRangePicker(element, options, cb)
363
+
364
+ | Param | Type | Description |
365
+ | --- | --- | --- |
366
+ | element | [<code>jQuery</code>](https://api.jquery.com/Types/#jQuery/) | jQuery selector of the parent element that the date range picker will be added to |
367
+ | options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
368
+ | cb | <code>function</code> | Callback function executed when |
369
+
370
+ <a name="DateRangePicker+setStartDate"></a>
371
+
372
+ ### dateRangePicker.setStartDate(startDate, isValid)
373
+ Sets the date range picker's currently selected start date to the provided date.<br/>
374
+ `startDate` must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or
375
+ a string matching `locale.format`.
376
+ The value of the attached `<input>` element is also updated.
377
+ Date value is rounded to match option `timePickerStepSize` unless skipped by `violated.daterangepicker` event handler.<br/>
378
+ If the `startDate` does not fall into `minDate` and `maxDate` then `startDate` is shifted unless skipped by `violated.daterangepicker` event handler.
379
+
380
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
381
+ **Throws**:
382
+
383
+ - `RangeError` for invalid date values.
384
+
385
+
386
+ | Param | Type | Default | Description |
387
+ | --- | --- | --- | --- |
388
+ | startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | | startDate to be set |
389
+ | isValid | <code>boolean</code> | <code>false</code> | If `true` then the `startDate` is not checked against `minDate` and `maxDate`<br/> Use this option only if you are sure about the value you put in. |
390
+
391
+ **Example**
392
+ ```js
393
+ const DateTime = luxon.DateTime;
394
+ const drp = $('#picker').data('daterangepicker');
395
+ drp.setStartDate(DateTime.now().startOf('hour'));
396
+ ```
397
+ <a name="DateRangePicker+setEndDate"></a>
398
+
399
+ ### dateRangePicker.setEndDate(endDate, isValid)
400
+ Sets the date range picker's currently selected end date to the provided date.<br/>
401
+ `endDate` must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or
402
+ a string matching`locale.format`.
403
+ The value of the attached `<input>` element is also updated.
404
+ Date value is rounded to match option `timePickerStepSize` unless skipped by `violated.daterangepicker` event handler.<br/>
405
+ If the `endDate` does not fall into `minDate` and `maxDate` or into `minSpan` and `maxSpan`
406
+ then `endDate` is shifted unless skipped by `violated.daterangepicker` event handler
407
+
408
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
409
+ **Throws**:
410
+
411
+ - `RangeError` for invalid date values.
412
+
413
+
414
+ | Param | Type | Default | Description |
415
+ | --- | --- | --- | --- |
416
+ | endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | | endDate to be set |
417
+ | isValid | <code>boolean</code> | <code>false</code> | If `true` then the `endDate` is not checked against `minDate`, `maxDate` and `minSpan`, `maxSpan`<br/> Use this option only if you are sure about the value you put in. |
418
+
419
+ **Example**
420
+ ```js
421
+ const drp = $('#picker').data('daterangepicker');
422
+ drp.setEndDate('2025-03-28T18:30:00');
423
+ ```
424
+ <a name="DateRangePicker+setPeriod"></a>
425
+
426
+ ### dateRangePicker.setPeriod(startDate, endDate, isValid)
427
+ Shortcut for [setStartDate](#DateRangePicker+setStartDate) and [setEndDate](#DateRangePicker+setEndDate)
428
+
429
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
430
+ **Throws**:
431
+
432
+ - `RangeError` for invalid date values.
433
+
434
+
435
+ | Param | Type | Default | Description |
436
+ | --- | --- | --- | --- |
437
+ | startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | | startDate to be set |
438
+ | endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | | endDate to be set |
439
+ | isValid | <code>boolean</code> | <code>false</code> | If `true` then the `startDate` and `endDate` are not checked against `minDate`, `maxDate` and `minSpan`, `maxSpan`<br/> Use this option only if you are sure about the value you put in. |
440
+
441
+ **Example**
442
+ ```js
443
+ const DateTime = luxon.DateTime;
444
+ const drp = $('#picker').data('daterangepicker');
445
+ drp.setPeriod(DateTime.now().startOf('week'), DateTime.now().startOf('week').plus({days: 10}));
446
+ ```
447
+ <a name="DateRangePicker+validateInput"></a>
448
+
449
+ ### dateRangePicker.validateInput([range]) ⇒ <code>Array</code> \| <code>null</code>
450
+ Validate `startDate` and `endDate` or `range` against `timePickerStepSize`, `minDate`, `maxDate`,
451
+ `minSpan`, `maxSpan`, `invalidDate` and `invalidTime` and corrects them, if needed.
452
+ Correction can be skipped by returning `true` at event listener for `violated.daterangepicker`
453
+
454
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
455
+ **Returns**: <code>Array</code> \| <code>null</code> - - Corrected range as array of `[startDate, endDate]` when `range` is defined
456
+ **Emits**: <code>event:&quot;violated.daterangepicker&quot;</code>
457
+
458
+ | Param | Type | Description |
459
+ | --- | --- | --- |
460
+ | [range] | <code>Array</code> | Used to check prefefined range instead of `startDate` and `endDate` => `[name, startDate, endDate]` When set, then function does not modify anything, just returning corrected range. |
461
+
462
+ **Example**
463
+ ```js
464
+ validateInput([DateTime.fromISO('2025-02-03'), DateTime.fromISO('2025-02-25')]) =>
465
+ [ DateTime.fromISO('2025-02-05'), DateTime.fromISO('2025-02-20'), { startDate: { violations: [{old: ..., new: ..., reasson: 'minDate'}] } } ]
466
+ ```
467
+ <a name="DateRangePicker+updateView"></a>
468
+
469
+ ### dateRangePicker.updateView()
470
+ Updates the picker when calendar is initiated or any date has been selected.
471
+ Could be useful after running [setStartDate](#DateRangePicker+setStartDate) or [setEndDate](#DateRangePicker+setEndDate)
472
+
473
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
474
+ **Emits**: <code>event:&quot;beforeRenderTimePicker.daterangepicker&quot;</code>
475
+ <a name="DateRangePicker+show"></a>
476
+
477
+ ### dateRangePicker.show()
478
+ Shows the picker
479
+
480
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
481
+ **Emits**: <code>event:&quot;show.daterangepicker&quot;</code>
482
+ <a name="DateRangePicker+hide"></a>
483
+
484
+ ### dateRangePicker.hide()
485
+ Hides the picker
486
+
487
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
488
+ **Emits**: <code>event:&quot;beforeHide.daterangepicker&quot;</code>, <code>event:&quot;hide.daterangepicker&quot;</code>
489
+ <a name="DateRangePicker+toggle"></a>
490
+
491
+ ### dateRangePicker.toggle()
492
+ Toggles visibility of the picker
493
+
494
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
495
+ <a name="DateRangePicker+showCalendars"></a>
496
+
497
+ ### dateRangePicker.showCalendars()
498
+ Shows calendar when user selects "Custom Ranges"
499
+
500
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
501
+ **Emits**: <code>event:&quot;showCalendar.daterangepicker&quot;</code>
502
+ <a name="DateRangePicker+hideCalendars"></a>
503
+
504
+ ### dateRangePicker.hideCalendars()
505
+ Hides calendar when user selects a predefined range
506
+
507
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
508
+ **Emits**: <code>event:&quot;hideCalendar.daterangepicker&quot;</code>
509
+ <a name="DateRangePicker+updateElement"></a>
510
+
511
+ ### dateRangePicker.updateElement()
512
+ Update attached `<input>` element with selected value
513
+
514
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
515
+ **Emits**: [<code>change</code>](https://api.jquery.com/change/)
516
+ <a name="DateRangePicker+updateAltInput"></a>
517
+
518
+ ### dateRangePicker.updateAltInput()
519
+ Update altInput `<input>` element with selected value
520
+
521
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
522
+ <a name="DateRangePicker+remove"></a>
523
+
524
+ ### dateRangePicker.remove()
525
+ Removes the picker from document
526
+
527
+ **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
528
+ <a name="DateRangePicker.daterangepicker"></a>
529
+
530
+ ### DateRangePicker.daterangepicker(options, callback) ⇒
531
+ Initiate a new DateRangePicker
532
+
533
+ **Kind**: static method of [<code>DateRangePicker</code>](#DateRangePicker)
534
+ **Returns**: DateRangePicker
535
+
536
+ | Param | Type | Description |
537
+ | --- | --- | --- |
538
+ | options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
539
+ | callback | [<code>callback</code>](#callback) | Callback function executed when date is changed.<br/> Callback function is executed if selected date values has changed, before picker is hidden and before the attached `<input>` element is updated. As alternative listen to the ["apply.daterangepicker"](#event_apply.daterangepicker) event |
540
+
541
+ <a name="event_violated.daterangepicker"></a>
542
+
543
+ ## "violated.daterangepicker" (this, result) ⇒ <code>boolean</code>
544
+ Emitted if the input values are not compliant to all constraints
545
+
546
+ **Kind**: event emitted
547
+ **Returns**: <code>boolean</code> - skip - If `true`, then input values are not corrected and remain invalid
548
+
549
+ | Param | Type | Description |
550
+ | --- | --- | --- |
551
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
552
+ | result | [<code>InputViolation</code>](#InputViolation) | An object of input violations |
553
+
554
+ **Example**
555
+ ```js
556
+ $('#picker').on('violated.daterangepicker', (ev, picker, result) => {
557
+ for (let vio of result.startDate.violations ) {
558
+ if (vio.reason === 'maxDate')
559
+ return true; // Ignore if startDate is later than maxDate
560
+ }
561
+ })
562
+ ```
563
+ <a name="event_beforeRenderCalendar.daterangepicker"></a>
564
+
565
+ ## "beforeRenderCalendar.daterangepicker" (this)
566
+ Emitted before the calendar is rendered.
567
+ Useful to remove any manually added elements.
568
+
569
+ **Kind**: event emitted
570
+
571
+ | Param | Type | Description |
572
+ | --- | --- | --- |
573
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
574
+
575
+ <a name="event_beforeRenderTimePicker.daterangepicker"></a>
576
+
577
+ ## "beforeRenderTimePicker.daterangepicker" (this)
578
+ Emitted before the TimePicker is rendered.
579
+ Useful to remove any manually added elements.
580
+
581
+ **Kind**: event emitted
582
+
583
+ | Param | Type | Description |
584
+ | --- | --- | --- |
585
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
586
+
587
+ <a name="event_show.daterangepicker"></a>
588
+
589
+ ## "show.daterangepicker" (this)
590
+ Emitted when the picker is shown
591
+
592
+ **Kind**: event emitted
593
+
594
+ | Param | Type | Description |
595
+ | --- | --- | --- |
596
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
597
+
598
+ <a name="event_beforeHide.daterangepicker"></a>
599
+
600
+ ## "beforeHide.daterangepicker" (this) ⇒ <code>boolean</code>
601
+ Emitted before the picker will hide. When EventHandler returns `true`, then picker remains visible
602
+
603
+ **Kind**: event emitted
604
+ **Returns**: <code>boolean</code> - cancel - If `true`, then the picker remains visible
605
+
606
+ | Param | Type | Description |
607
+ | --- | --- | --- |
608
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
609
+
610
+ <a name="event_hide.daterangepicker"></a>
611
+
612
+ ## "hide.daterangepicker" (this)
613
+ Emitted when the picker is hidden
614
+
615
+ **Kind**: event emitted
616
+
617
+ | Param | Type | Description |
618
+ | --- | --- | --- |
619
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
620
+
621
+ <a name="event_outsideClick.daterangepicker"></a>
622
+
623
+ ## "outsideClick.daterangepicker" (this)
624
+ Emitted when user clicks outside the picker.
625
+ Use option `onOutsideClick` to define the default action, then you may not need to handle this event.
626
+
627
+ **Kind**: event emitted
628
+
629
+ | Param | Type | Description |
630
+ | --- | --- | --- |
631
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
632
+
633
+ <a name="event_showCalendar.daterangepicker"></a>
634
+
635
+ ## "showCalendar.daterangepicker" (this)
636
+ Emitted when the calendar(s) are shown.
637
+ Only useful when [Ranges](#Ranges) are used.
638
+
639
+ **Kind**: event emitted
640
+
641
+ | Param | Type | Description |
642
+ | --- | --- | --- |
643
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
644
+
645
+ <a name="event_hideCalendar.daterangepicker"></a>
646
+
647
+ ## "hideCalendar.daterangepicker" (this)
648
+ Emitted when the calendar(s) are hidden.
649
+ Only useful when [Ranges](#Ranges) are used.
650
+
651
+ **Kind**: event emitted
652
+
653
+ | Param | Type | Description |
654
+ | --- | --- | --- |
655
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
656
+
657
+ <a name="event_dateChange.daterangepicker"></a>
658
+
659
+ ## "dateChange.daterangepicker" (this, side)
660
+ Emitted when the date changed. Does not trigger when time is changed,
661
+ use ["timeChange.daterangepicker"](#event_timeChange.daterangepicker) to handle it
662
+
663
+ **Kind**: event emitted
664
+
665
+ | Param | Type | Description |
666
+ | --- | --- | --- |
667
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
668
+ | side | <code>string</code> | Either `'start'` or `'end'` indicating whether startDate or endDate was changed. `null` when `singleDatePicker: true` |
669
+
670
+ <a name="event_apply.daterangepicker"></a>
671
+
672
+ ## "apply.daterangepicker" (this)
673
+ Emitted when the `Apply` button is clicked, or when a predefined [Ranges](#Ranges) is clicked
674
+
675
+ **Kind**: event emitted
676
+
677
+ | Param | Type | Description |
678
+ | --- | --- | --- |
679
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
680
+
681
+ <a name="event_cancel.daterangepicker"></a>
682
+
683
+ ## "cancel.daterangepicker" (this)
684
+ Emitted when the `Cancel` button is clicked
685
+
686
+ **Kind**: event emitted
687
+
688
+ | Param | Type | Description |
689
+ | --- | --- | --- |
690
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
691
+
692
+ <a name="event_timeChange.daterangepicker"></a>
693
+
694
+ ## "timeChange.daterangepicker" (this, side)
695
+ Emitted when the time changed. Does not trigger when date is changed
696
+
697
+ **Kind**: event emitted
698
+
699
+ | Param | Type | Description |
700
+ | --- | --- | --- |
701
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
702
+ | side | <code>string</code> | Either `'start'` or `'end'` indicating whether startDate or endDate was changed |
703
+
704
+ <a name="event_inputChanged.daterangepicker"></a>
705
+
706
+ ## "inputChanged.daterangepicker" (this)
707
+ Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid and date value has changed
708
+
709
+ **Kind**: event emitted
710
+
711
+ | Param | Type | Description |
712
+ | --- | --- | --- |
713
+ | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
714
+
715
+ <a name="Options"></a>
716
+
717
+ ## Options
718
+ Options for DateRangePicker
719
+
720
+ **Kind**: global typedef
721
+ **Properties**
722
+
723
+ | Name | Type | Default | Description |
724
+ | --- | --- | --- | --- |
725
+ | parentEl | <code>string</code> | <code>&quot;body&quot;</code> | [jQuery selector](https://api.jquery.com/category/selectors/) of the parent element that the date range picker will be added to |
726
+ | startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('day')`<br/>The beginning date of the initially selected date range.<br/> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br/> Date value is rounded to match option `timePickerStepSize`<br/> Option `isInvalidDate` and `isInvalidTime` are not evaluated, you may set date/time which is not selectable in calendar.<br/> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br/> Use `startDate: null` to show calendar without an inital selected date. |
727
+ | endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | | Defautl: `DateTime.now().endOf('day')`<br/>The end date of the initially selected date range.<br/> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br/> Date value is rounded to match option `timePickerStepSize`<br/> Option `isInvalidDate`, `isInvalidTime` and `minSpan`, `maxSpan` are not evaluated, you may set date/time which is not selectable in calendar.<br/> If the date does not fall into `minDate` and `maxDate` then date is shifted and a warning is written to console.<br/> |
728
+ | minDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | The earliest date a user may select or `null` for no limit.<br/> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`. |
729
+ | maxDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | The latest date a user may select or `null` for no limit.<br/> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`. |
730
+ | minSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The minimum span between the selected start and end dates.<br/> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br/> Ignored when `singleDatePicker: true` |
731
+ | maxSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The maximum span between the selected start and end dates.<br/> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br/> Ignored when `singleDatePicker: true` |
732
+ | defaultSpan | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> \| <code>null</code> | | The span which is used when endDate is automatically updated due to wrong user input<br/> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br/> Ignored when `singleDatePicker: true`. Not relevant if `minSpan: null` |
733
+ | initalMonth | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> \| <code>null</code> | | Default: `DateTime.now().startOf('month')`<br/> The inital month shown when `startDate: null`. Be aware, the attached `<input>` element must be also empty.<br/> Must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) or a string matching `locale.format`.<br/> When `initalMonth` is used, then `endDate` is ignored and it works only with `timePicker: false` |
734
+ | autoApply | <code>boolean</code> | <code>false</code> | Hide the `Apply` and `Cancel` buttons, and automatically apply a new date range as soon as two dates are clicked.<br/> Only useful when `timePicker: false` |
735
+ | singleDatePicker | <code>boolean</code> | <code>false</code> | Show only a single calendar to choose one date, instead of a range picker with two calendars.<br/> The start and end dates provided to your callback will be the same single date chosen. |
736
+ | singleMonthView | <code>boolean</code> | <code>false</code> | Show only a single month calendar, useful when selected ranges are usually short<br/> or for smaller viewports like mobile devices.<br/> Ignored for `singleDatePicker: true`. |
737
+ | showDropdowns | <code>boolean</code> | <code>false</code> | Show year and month select boxes above calendars to jump to a specific month and year |
738
+ | minYear | <code>number</code> | | Default: `DateTime.now().minus({year:100}).year`<br/>The minimum year shown in the dropdowns when `showDropdowns: true` |
739
+ | maxYear | <code>number</code> | | Default: `DateTime.now().plus({year:100}).year`<br/>The maximum year shown in the dropdowns when `showDropdowns: true` |
740
+ | showWeekNumbers | <code>boolean</code> | <code>false</code> | Show **localized** week numbers at the start of each week on the calendars |
741
+ | showISOWeekNumbers | <code>boolean</code> | <code>false</code> | Show **ISO** week numbers at the start of each week on the calendars.<br/> Takes precedence over localized `showWeekNumbers` |
742
+ | timePicker | <code>boolean</code> | <code>false</code> | Adds select boxes to choose times in addition to dates |
743
+ | timePicker24Hour | <code>boolean</code> | <code>true|false</code> | Use 24-hour instead of 12-hour times, removing the AM/PM selection.<br/> Default is derived from current locale [Intl.DateTimeFormat.resolvedOptions.hour12](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/resolvedOptions#hour12). |
744
+ | timePickerStepSize | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> \| <code>number</code> | | Default: `Duration.fromObject({minutes:1})`<br/>Set the time picker step size.<br/> Must be a `luxon.Duration` or the number of seconds or a string according to [ISO-8601](https://en.wikipedia.org/wiki/ISO_8601) duration.<br/> Valid values are 1,2,3,4,5,6,10,12,15,20,30 for `Duration.fromObject({seconds: ...})` and `Duration.fromObject({minutes: ...})` and 1,2,3,4,6,(8,12) for `Duration.fromObject({hours: ...})`.<br/> Duration must be greater than `minSpan` and smaller than `maxSpan`.<br/> For example `timePickerStepSize: 600` will disable time picker seconds and time picker minutes are set to step size of 10 Minutes.<br/> Overwrites `timePickerIncrement` and `timePickerSeconds`, ignored when `timePicker: false` |
745
+ | timePickerSeconds | <code>boolean</code> | <code>boolean</code> | **Deprecated**, use `timePickerStepSize`<br/>Show seconds in the timePicker |
746
+ | timePickerIncrement | <code>boolean</code> | <code>1</code> | **Deprecated**, use `timePickerStepSize`<br/>Increment of the minutes selection list for times |
747
+ | autoUpdateInput | <code>boolean</code> | <code>true</code> | Indicates whether the date range picker should instantly update the value of the attached `<input>` element when the selected dates change.<br/>The `<input>` element will be always updated on `Apply` and reverted when user clicks on `Cancel`. |
748
+ | onOutsideClick | <code>string</code> | <code>&quot;apply&quot;</code> | Defines what picker shall do when user clicks outside the calendar. `'apply'` or `'cancel'`. Event [onOutsideClick.daterangepicker](#event_outsideClick.daterangepicker) is always emitted. |
749
+ | linkedCalendars | <code>boolean</code> | <code>true</code> | When enabled, the two calendars displayed will always be for two sequential months (i.e. January and February), and both will be advanced when clicking the left or right arrows above the calendars.<br/> When disabled, the two calendars can be individually advanced and display any month/year |
750
+ | isInvalidDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed,<br/> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br/> Signature: `isInvalidDate(date)`<br/> Function has no effect on date values set by `startDate`, `endDate`, `ranges`, [setStartDate](#DateRangePicker+setStartDate), [setEndDate](#DateRangePicker+setEndDate). |
751
+ | isInvalidTime | <code>function</code> | <code>false</code> | A function that is passed each hour/minute/second/am-pm in the two calendars before they are displayed,<br/> and may return `true` or `false` to indicate whether that date should be available for selection or not.<br/> Signature: `isInvalidTime(time, side, unit)`<br/> `side` is `'start'` or `'end'` or `null` for `singleDatePicker: true`<br/> `unit` is `'hour'`, `'minute'`, `'second'` or `'ampm'`<br/> Hours are always given as 24-hour clock<br/> Function has no effect on time values set by `startDate`, `endDate`, `ranges`, [setStartDate](#DateRangePicker+setStartDate), [setEndDate](#DateRangePicker+setEndDate).<br/> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br/> |
752
+ | isCustomDate | <code>function</code> | <code>false</code> | A function that is passed each date in the two calendars before they are displayed, and may return a string or array of CSS class names to apply to that date's calendar cell.<br/> Signature: `isCustomDate(date)` |
753
+ | altInput | <code>string</code> \| <code>Array</code> | <code>null</code> | A [jQuery selector](https://api.jquery.com/category/selectors/) string for an alternative output (typically hidden) `<input>` element. Uses `altFormat` to format the value.<br/> Must be a single string for `singleDatePicker: true` or an array of two strings for `singleDatePicker: false`<br/> Example: `['#start', '#end']` |
754
+ | altFormat | <code>function</code> \| <code>string</code> | | The output format used for `altInput`.<br/> Default: ISO-8601 basic format without time zone, precisison is derived from `timePicker` and `timePickerStepSize`<br/> Example `yyyyMMdd'T'HHmm` for `timePicker=true` and display of Minutes<br/> If defined, either a string used with [Format tokens](https://moment.github.io/luxon/#/formatting?id=table-of-tokens) or a function.<br/> Examples: `"yyyy:MM:dd'T'HH:mm"`,<br/>`(date) => date.toUnixInteger()` |
755
+ | ~~warnings~~ | <code>boolean</code> | | Not used anymore. Listen to event `violated.daterangepicker` to react on invalid input data |
756
+ | applyButtonClasses | <code>string</code> | <code>&quot;btn-primary&quot;</code> | CSS class names that will be added only to the apply button |
757
+ | cancelButtonClasses | <code>string</code> | <code>&quot;btn-default&quot;</code> | CSS class names that will be added only to the cancel button |
758
+ | buttonClasses | <code>string</code> | | Default: `'btn btn-sm'`<br/>CSS class names that will be added to both the apply and cancel buttons. |
759
+ | weekendClasses | <code>string</code> | <code>&quot;weekend&quot;</code> | CSS class names that will be used to highlight weekend days.<br/> Use `null` or empty string if you don't like to highlight weekend days. |
760
+ | weekendDayClasses | <code>string</code> | <code>&quot;weekend-day&quot;</code> | CSS class names that will be used to highlight weekend day names.<br/> Weekend days are evaluated by [Info.getWeekendWeekdays](https://moment.github.io/luxon/api-docs/index.html#infogetweekendweekdays) and depend on current locale settings. Use `null` or empty string if you don't like to highlight weekend day names. |
761
+ | todayClasses | <code>string</code> | <code>&quot;today&quot;</code> | CSS class names that will be used to highlight the current day.<br/> Use `null` or empty string if you don't like to highlight the current day. |
762
+ | externalStyle | <code>string</code> | <code>null</code> | External CSS Framework to style the picker. Currently only `'bulma'` is supported. |
763
+ | opens | <code>string</code> | <code>&quot;right&quot;</code> | Whether the picker appears aligned to the left, to the right, or centered under the HTML element it's attached to.<br/> `'left' \| 'right' \| 'center'` |
764
+ | drops | <code>string</code> | <code>&quot;down&quot;</code> | Whether the picker appears below or above the HTML element it's attached to.<br/> `'down' \| 'up' \| 'auto'` |
765
+ | ranges | <code>object</code> | <code>{}</code> | Set predefined date [Ranges](#Ranges) the user can select from. Each key is the label for the range, and its value an array with two dates representing the bounds of the range. |
766
+ | showCustomRangeLabel | <code>boolean</code> | <code>true</code> | Displays "Custom Range" at the end of the list of predefined [Ranges](#Ranges), when the ranges option is used.<br> This option will be highlighted whenever the current date range selection does not match one of the predefined ranges.<br/> Clicking it will display the calendars to select a new range. |
767
+ | alwaysShowCalendars | <code>boolean</code> | <code>false</code> | Normally, if you use the ranges option to specify pre-defined date ranges, calendars for choosing a custom date range are not shown until the user clicks "Custom Range".<br/> When this option is set to true, the calendars for choosing a custom date range are always shown instead. |
768
+ | locale | <code>object</code> | <code>{}</code> | Allows you to provide localized strings for buttons and labels, customize the date format, and change the first day of week for the calendars. |
769
+ | locale.direction | <code>string</code> | <code>&quot;ltr&quot;</code> | Direction of reading, `'ltr'` or `'rtl'` |
770
+ | locale.format | <code>object</code> \| <code>string</code> | | Default: `DateTime.DATE_SHORT` or `DateTime.DATETIME_SHORT` when `timePicker: true`<br/>Date formats. Either given as string, see [Format Tokens](https://moment.github.io/luxon/#/formatting?id=table-of-tokens) or an object according to [Intl.DateTimeFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat)<br/> I recommend to use the luxon [Presets](https://moment.github.io/luxon/#/formatting?id=presets). |
771
+ | locale.separator | <code>string</code> | | Defaut: `' - '`<br/>Separator for start and end time |
772
+ | locale.weekLabel | <code>string</code> | <code>&quot;W&quot;</code> | Label for week numbers |
773
+ | locale.daysOfWeek | <code>Array</code> | | Default: `luxon.Info.weekdays('short')`<br/>Array with weekday names, from Monday to Sunday |
774
+ | locale.monthNames | <code>Array</code> | | Default: `luxon.Info.months('long')`<br/>Array with month names |
775
+ | locale.firstDay | <code>number</code> | | Default: `luxon.Info.getStartOfWeek()`<br/>First day of the week, 1 for Monday through 7 for Sunday |
776
+ | locale.applyLabel | <code>string</code> | <code>&quot;Apply&quot;</code> | Label of `Apply` Button |
777
+ | locale.cancelLabel | <code>string</code> | <code>&quot;Cancel&quot;</code> | Label of `Cancel` Button |
778
+ | locale.customRangeLabel | <code>string</code> | <code>&quot;Custom&quot;</code> | Range - Title for custom ranges |
779
+ | locale.durationFormat | <code>object</code> \| <code>string</code> \| <code>function</code> | <code>{}</code> | Format a custom label for selected duration, for example `'5 Days, 12 Hours'`.<br/> Define the format either as string, see [Duration.toFormat - Format Tokens](https://moment.github.io/luxon/api-docs/index.html#durationtoformat) or an object according to [Intl.NumberFormat](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/NumberFormat#options), see [Duration.toHuamn](https://moment.github.io/luxon/api-docs/index.html#durationtohuman).<br/> Or custom function as `(startDate, endDate) => {}` |
780
+
781
+ <a name="Ranges"></a>
782
+
783
+ ## Ranges : <code>Object</code>
784
+ A set of predefined ranges
785
+
786
+ **Kind**: global typedef
787
+ **Properties**
788
+
789
+ | Name | Type | Description |
790
+ | --- | --- | --- |
791
+ | name | <code>string</code> | The name of the range |
792
+ | range | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | Array of 2 elements with startDate and endDate |
793
+
794
+ **Example**
795
+ ```js
796
+ {
797
+ 'Today': [DateTime.now().startOf('day'), DateTime.now().endOf('day')],
798
+ 'Yesterday': [DateTime.now().startOf('day').minus({days: 1}), DateTime.now().minus({days: 1}).endOf('day')],
799
+ 'Last 7 Days': [DateTime.now().startOf('day').minus({days: 6}), DateTime.now()],
800
+ 'Last 30 Days': [DateTime.now().startOf('day').minus({days: 29}), DateTime.now()],
801
+ 'This Month': [DateTime.now().startOf('day').startOf('month'), DateTime.now().endOf('month')],
802
+ 'Last Month': [DateTime.now().startOf('day').minus({months: 1}).startOf('month'), DateTime.now().minus({months: 1}).endOf('month')]
803
+ }
804
+ ```
805
+ <a name="Range"></a>
806
+
807
+ ## Range : <code>Object</code>
808
+ A single predefined range
809
+
810
+ **Kind**: global typedef
811
+ **Properties**
812
+
813
+ | Name | Type | Description |
814
+ | --- | --- | --- |
815
+ | name | <code>string</code> | The name of the range |
816
+ | range | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| [<code>Date</code>](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) \| <code>string</code> | Array of 2 elements with startDate and endDate |
817
+
818
+ **Example**
819
+ ```js
820
+ { Today: [DateTime.now().startOf('day'), DateTime.now().endOf('day')] }
821
+ ```
822
+ <a name="InputViolation"></a>
823
+
824
+ ## InputViolation : <code>Object</code>
825
+ **Kind**: global typedef
826
+ **Properties**
827
+
828
+ | Name | Type | Description |
829
+ | --- | --- | --- |
830
+ | startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Violation of startDate |
831
+ | endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| <code>undefined</code> | Violation of endDate |
832
+ | reason | <code>Array</code> | The constraint which violates the input |
833
+ | old | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Old value startDate/endDate |
834
+ | new | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Corrected value of startDate/endDate |
835
+
836
+ <a name="callback"></a>
837
+
838
+ ## callback : <code>function</code>
839
+ **Kind**: global typedef
840
+
841
+ | Param | Type | Description |
842
+ | --- | --- | --- |
843
+ | startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Selected startDate |
844
+ | endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Selected endDate |
845
+ | range | <code>string</code> | |
4
846