@wernfried/daterangepicker 4.16.10 → 4.17.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
@@ -20,8 +20,8 @@ Above samples are based on the [original repository](https://github.com/dangross
20
20
  ```html
21
21
  <script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
22
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.16.10/dist/global/daterangepicker.min.js"></script>
24
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.16.10/css/daterangepicker.min.css" rel="stylesheet" />
23
+ <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.17.0/dist/global/daterangepicker.min.js"></script>
24
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.17.0/css/daterangepicker.min.css" rel="stylesheet" />
25
25
 
26
26
  <input type="text" id="picker" />
27
27
 
@@ -43,11 +43,11 @@ Above samples are based on the [original repository](https://github.com/dangross
43
43
  "imports": {
44
44
  "jquery": "https://cdn.jsdelivr.net/npm/jquery@4.0.0/+esm",
45
45
  "luxon": "https://cdn.jsdelivr.net/npm/luxon@3.7.2/+esm",
46
- "daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.16.10/+esm"
46
+ "daterangepicker": "https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.17.0/+esm"
47
47
  }
48
48
  }
49
49
  </script>
50
- <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.16.10/css/daterangepicker.min.css" rel="stylesheet" />
50
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.17.0/css/daterangepicker.min.css" rel="stylesheet" />
51
51
 
52
52
  <input type="text" id="picker" />
53
53
 
@@ -68,7 +68,7 @@ Above samples are based on the [original repository](https://github.com/dangross
68
68
  ```html
69
69
  <script ...></script>
70
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.16.10/css/daterangepicker.bulma.min.css" rel="stylesheet" />
71
+ <link type="text/css" href="https://cdn.jsdelivr.net/npm/@wernfried/daterangepicker@4.17.0/css/daterangepicker.bulma.min.css" rel="stylesheet" />
72
72
 
73
73
  <input type="text" id="picker" />
74
74
 
@@ -171,11 +171,12 @@ Compared to [inital repository](https://github.com/dangrossman/daterangepicker),
171
171
  - Added option `singleMonthView` to show single month calendar, useful for shorter ranges
172
172
  - Better validation of input parameters, errors are logged to console
173
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/>
174
+ - Option `autoUpdateInput` defines whether the attached `<input>` element is updated when the user clicks on a date value.<br>
175
175
  In original daterangepicker this parameter defines whether the `<input>` is updated when the user clicks on `Apply` button.
176
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/>
177
+ - Added option `externalStyle` to use daterangepicker with external CSS Frameworks. Currently only [Bulma](https://bulma.io/) is supported<br>
178
178
  but other frameworks may be added in future releases
179
+ - [ESM](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Modules) Module Import
179
180
  - [Jest](https://jestjs.io/) unit testing
180
181
  - ... and maybe some new bugs 😉
181
182
 
@@ -254,666 +255,5 @@ Copyright (c) 2025 Wernfried Domscheit
254
255
 
255
256
  Licensed under the [MIT license](LICENSE).
256
257
 
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, picker, result, newDate)</a> ⇒ <code>boolean</code></dt>
269
- <dd><p>Emitted when the date is changed through <code>&lt;input&gt;</code> element or via <a href="#DateRangePicker+setStartDate">setStartDate</a> or
270
- <a href="#DateRangePicker+setRange">setRange</a> and date is not valid due to
271
- <code>minDate</code>, <code>maxDate</code>, <code>minSpan</code>, <code>maxSpan</code>, <code>invalidDate</code> and <code>invalidTime</code> constraints.<br>
272
- Event is only triggered when date string is valid and date value is changing<br></p>
273
- </dd>
274
- <dt><a href="#event_beforeRenderCalendar.daterangepicker">"beforeRenderCalendar.daterangepicker" (this)</a></dt>
275
- <dd><p>Emitted before the calendar is rendered.
276
- Useful to remove any manually added elements.</p>
277
- </dd>
278
- <dt><a href="#event_beforeRenderTimePicker.daterangepicker">"beforeRenderTimePicker.daterangepicker" (this)</a></dt>
279
- <dd><p>Emitted before the TimePicker is rendered.
280
- Useful to remove any manually added elements.</p>
281
- </dd>
282
- <dt><a href="#event_show.daterangepicker">"show.daterangepicker" (this)</a></dt>
283
- <dd><p>Emitted when the picker is shown</p>
284
- </dd>
285
- <dt><a href="#event_beforeHide.daterangepicker">"beforeHide.daterangepicker" (this)</a> ⇒ <code>boolean</code></dt>
286
- <dd><p>Emitted before the picker will hide. When EventHandler returns <code>true</code>, then picker remains visible</p>
287
- </dd>
288
- <dt><a href="#event_hide.daterangepicker">"hide.daterangepicker" (this)</a></dt>
289
- <dd><p>Emitted when the picker is hidden</p>
290
- </dd>
291
- <dt><a href="#event_outsideClick.daterangepicker">"outsideClick.daterangepicker" (this)</a></dt>
292
- <dd><p>Emitted when user clicks outside the picker.
293
- Use option <code>onOutsideClick</code> to define the default action, then you may not need to handle this event.</p>
294
- </dd>
295
- <dt><a href="#event_showCalendar.daterangepicker">"showCalendar.daterangepicker" (this)</a></dt>
296
- <dd><p>Emitted when the calendar(s) are shown.
297
- Only useful when <a href="#Ranges">Ranges</a> are used.</p>
298
- </dd>
299
- <dt><a href="#event_hideCalendar.daterangepicker">"hideCalendar.daterangepicker" (this)</a></dt>
300
- <dd><p>Emitted when the calendar(s) are hidden.
301
- Only useful when <a href="#Ranges">Ranges</a> are used.</p>
302
- </dd>
303
- <dt><a href="#event_dateChange.daterangepicker">"dateChange.daterangepicker" (this, side)</a></dt>
304
- <dd><p>Emitted when the date changed. Does not trigger when time is changed,
305
- use <a href="#event_timeChange.daterangepicker">&quot;timeChange.daterangepicker&quot;</a> to handle it</p>
306
- </dd>
307
- <dt><a href="#event_apply.daterangepicker">"apply.daterangepicker" (this)</a></dt>
308
- <dd><p>Emitted when the <code>Apply</code> button is clicked, or when a predefined <a href="#Ranges">Ranges</a> is clicked</p>
309
- </dd>
310
- <dt><a href="#event_cancel.daterangepicker">"cancel.daterangepicker" (this)</a></dt>
311
- <dd><p>Emitted when the <code>Cancel</code> button is clicked</p>
312
- </dd>
313
- <dt><a href="#event_timeChange.daterangepicker">"timeChange.daterangepicker" (this, side)</a></dt>
314
- <dd><p>Emitted when the time changed. Does not trigger when date is changed</p>
315
- </dd>
316
- <dt><a href="#event_inputChanged.daterangepicker">"inputChanged.daterangepicker" (this)</a></dt>
317
- <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>
318
- </dd>
319
- </dl>
320
-
321
- ## Typedefs
322
-
323
- <dl>
324
- <dt><a href="#Options">Options</a></dt>
325
- <dd><p>Options for DateRangePicker</p>
326
- </dd>
327
- <dt><a href="#Ranges">Ranges</a> : <code>Object</code></dt>
328
- <dd><p>A set of predefined ranges.<br>
329
- Ranges are not validated against <code>minDate</code>, <code>maxDate</code>, <code>minSpan</code>, <code>maxSpan</code> or <code>timePickerStepSize </code> constraints.</p>
330
- </dd>
331
- <dt><a href="#Range">Range</a> : <code>Object</code></dt>
332
- <dd><p>A single predefined range</p>
333
- </dd>
334
- <dt><a href="#InputViolation">InputViolation</a> : <code>Object</code></dt>
335
- <dd></dd>
336
- <dt><a href="#callback">callback</a> : <code>function</code></dt>
337
- <dd></dd>
338
- </dl>
339
-
340
- <a name="DateRangePicker"></a>
341
-
342
- ## DateRangePicker
343
- **Kind**: global class
344
-
345
- * [DateRangePicker](#DateRangePicker)
346
- * [new DateRangePicker(element, options, cb)](#new_DateRangePicker_new)
347
- * _instance_
348
- * [.startDate](#DateRangePicker+startDate) : [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
349
- * [.endDate](#DateRangePicker+endDate) : [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
350
- * [.setStartDate(startDate, updateView)](#DateRangePicker+setStartDate) ⇒ [<code>InputViolation</code>](#InputViolation)
351
- * [.setEndDate(endDate, updateView)](#DateRangePicker+setEndDate) ⇒ [<code>InputViolation</code>](#InputViolation)
352
- * [.setRange(startDate, endDate, updateView)](#DateRangePicker+setRange) ⇒ [<code>InputViolation</code>](#InputViolation)
353
- * [.parseDate(value)](#DateRangePicker+parseDate) ⇒ [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
354
- * [.formatDate(date, format)](#DateRangePicker+formatDate) ⇒ <code>string</code>
355
- * [.validateInput(range, dipatch)](#DateRangePicker+validateInput) ⇒ [<code>InputViolation</code>](#InputViolation) \| <code>null</code>
356
- * [.updateView()](#DateRangePicker+updateView)
357
- * [.show()](#DateRangePicker+show)
358
- * [.hide()](#DateRangePicker+hide)
359
- * [.toggle()](#DateRangePicker+toggle)
360
- * [.showCalendars()](#DateRangePicker+showCalendars)
361
- * [.hideCalendars()](#DateRangePicker+hideCalendars)
362
- * [.updateElement()](#DateRangePicker+updateElement)
363
- * [.updateAltInput()](#DateRangePicker+updateAltInput)
364
- * [.remove()](#DateRangePicker+remove)
365
- * _static_
366
- * [.daterangepicker(options, callback)](#DateRangePicker.daterangepicker) ⇒
367
-
368
- <a name="new_DateRangePicker_new"></a>
369
-
370
- ### new DateRangePicker(element, options, cb)
371
-
372
- | Param | Type | Description |
373
- | --- | --- | --- |
374
- | 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 |
375
- | options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
376
- | cb | <code>function</code> | Callback function executed when |
377
-
378
- <a name="DateRangePicker+startDate"></a>
379
-
380
- ### dateRangePicker.startDate : [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
381
- startDate
382
-
383
- **Kind**: instance property of [<code>DateRangePicker</code>](#DateRangePicker)
384
- <a name="DateRangePicker+endDate"></a>
385
-
386
- ### dateRangePicker.endDate : [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
387
- endDate
388
-
389
- **Kind**: instance property of [<code>DateRangePicker</code>](#DateRangePicker)
390
- <a name="DateRangePicker+setStartDate"></a>
391
-
392
- ### dateRangePicker.setStartDate(startDate, updateView) ⇒ [<code>InputViolation</code>](#InputViolation)
393
- Sets the date range picker's currently selected start date to the provided date.<br>
394
- `startDate` must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or a string matching `locale.format`.<br>
395
- Invalid date values are handled by [violated](#DateRangePicker+violated) Event
396
-
397
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
398
- **Returns**: [<code>InputViolation</code>](#InputViolation) - - Object of violations or `null` if no violation have been found
399
-
400
- | Param | Type | Default | Description |
401
- | --- | --- | --- | --- |
402
- | 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. In case of ranges, the current `endDate` is used. |
403
- | updateView | <code>boolean</code> | <code>true</code> | If `true`, then calendar UI is updated to new value. Otherwise only internal values are set. |
404
-
405
- **Example**
406
- ```js
407
- const drp = $('#picker').data('daterangepicker');
408
- drp.setStartDate(DateTime.now().startOf('hour'));
409
- ```
410
- <a name="DateRangePicker+setEndDate"></a>
411
-
412
- ### dateRangePicker.setEndDate(endDate, updateView) ⇒ [<code>InputViolation</code>](#InputViolation)
413
- Sets the date range picker's currently selected start date to the provided date.<br>
414
- `endDate` must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or a string matching `locale.format`.<br>
415
- Invalid date values are handled by [violated](#DateRangePicker+violated) Event
416
-
417
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
418
- **Returns**: [<code>InputViolation</code>](#InputViolation) - - Object of violations or `null` if no violation have been found
419
-
420
- | Param | Type | Default | Description |
421
- | --- | --- | --- | --- |
422
- | 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. In case of ranges, the current `startDate` is used. |
423
- | updateView | <code>boolean</code> | <code>true</code> | If `true`, then calendar UI is updated to new value. Otherwise only internal values are set. |
424
-
425
- **Example**
426
- ```js
427
- const drp = $('#picker').data('daterangepicker');
428
- drp.setEndDate(DateTime.now().startOf('hour'));
429
- ```
430
- <a name="DateRangePicker+setRange"></a>
431
-
432
- ### dateRangePicker.setRange(startDate, endDate, updateView) ⇒ [<code>InputViolation</code>](#InputViolation)
433
- Sets the date range picker's currently selected start date to the provided date.<br>
434
- `startDate` and `endDate` must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or a string matching `locale.format`.<br>
435
- Invalid date values are handled by [violated](#DateRangePicker+violated) Event
436
-
437
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
438
- **Returns**: [<code>InputViolation</code>](#InputViolation) - - Object of violations or `null` if no violation have been found
439
-
440
- | Param | Type | Default | Description |
441
- | --- | --- | --- | --- |
442
- | 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 |
443
- | 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 |
444
- | updateView | <code>boolean</code> | <code>true</code> | If `true`, then calendar UI is updated to new value. Otherwise only internal values are set. |
445
-
446
- **Example**
447
- ```js
448
- const drp = $('#picker').data('daterangepicker');
449
- drp.setRange(DateTime.now().startOf('hour'), DateTime.now().endOf('day'));
450
- ```
451
- <a name="DateRangePicker+parseDate"></a>
452
-
453
- ### dateRangePicker.parseDate(value) ⇒ [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
454
- Parse date value
455
-
456
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
457
- **Returns**: [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) - - DateTime object
458
-
459
- | Param | Type | Description |
460
- | --- | --- | --- |
461
- | value | <code>sting</code> \| [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| <code>Date</code> | The value to be parsed |
462
-
463
- <a name="DateRangePicker+formatDate"></a>
464
-
465
- ### dateRangePicker.formatDate(date, format) ⇒ <code>string</code>
466
- Format a DateTime object
467
-
468
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
469
- **Returns**: <code>string</code> - - Formatted date string
470
-
471
- | Param | Type | Default | Description |
472
- | --- | --- | --- | --- |
473
- | date | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | | The DateTime to format |
474
- | format | <code>object</code> \| <code>string</code> | <code>this.locale.format</code> | The format option |
475
-
476
- <a name="DateRangePicker+validateInput"></a>
477
-
478
- ### dateRangePicker.validateInput(range, dipatch) ⇒ [<code>InputViolation</code>](#InputViolation) \| <code>null</code>
479
- Validate `startDate` and `endDate` against `timePickerStepSize`, `minDate`, `maxDate`,
480
- `minSpan`, `maxSpan`, `invalidDate` and `invalidTime`.
481
-
482
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
483
- **Returns**: [<code>InputViolation</code>](#InputViolation) \| <code>null</code> - - Object of violations and corrected values or `null` if no violation have been found
484
- **Emits**: <code>event:&quot;violated.daterangepicker&quot;</code>
485
-
486
- | Param | Type | Default | Description |
487
- | --- | --- | --- | --- |
488
- | range | <code>Array</code> | <code>[startDate,</code> | endDate] - Range to be checked, defaults to current `startDate` and `endDate` |
489
- | dipatch | <code>boolean</code> | <code>false</code> | If `true` then event "violated.daterangepicker" is dispated.<br> If eventHandler returns `true`, then `null` is returned, otherwiese the object of violations. |
490
-
491
- **Example**
492
- ```js
493
- options => {
494
- minDate: DateTime.now().minus({months: 3}).startOf('day'),
495
- maxDate: DateTime.now().minus({day: 3}).startOf('day'),
496
- minSpan: Duration.fromObject({days: 7}),
497
- maxSpan: Duration.fromObject({days: 70}),
498
- timePickerStepSize: Duration.fromObject({hours: 1})
499
- }
500
- const result = validateInput(DateTime.now(), DateTime.now().plus({day: 3}));
501
-
502
- result => {
503
- startDate: {
504
- violations: [
505
- { old: "2026-03-13T10:35:52", reason: "timePickerStepSize", new: "2026-03-13T11:00:00" },
506
- { old: "2026-03-13T11:00:00", reason: "maxDate", new: "2026-03-10T00:00:00" }
507
- ]
508
- },
509
- endDate: {
510
- violations: [
511
- { old: "2026-03-16T10:35:52", reason: "stepSize", new: "2026-03-16T11:00:00" },
512
- { old: "2026-03-16T11:00:00", reason: "maxDate", new: "2026-03-10T00:00:00" },
513
- { old: "2026-03-10T00:00:00", reason: "minSpan", new: "2026-03-17T00:00:00" }
514
- ]
515
- }
516
- }
517
- ```
518
- <a name="DateRangePicker+updateView"></a>
519
-
520
- ### dateRangePicker.updateView()
521
- Updates the picker when calendar is initiated or any date has been selected.
522
- Could be useful after running [setStartDate](#DateRangePicker+setStartDate) or [setRange](#DateRangePicker+setEndDate)
523
-
524
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
525
- **Emits**: <code>event:&quot;beforeRenderTimePicker.daterangepicker&quot;</code>
526
- <a name="DateRangePicker+show"></a>
527
-
528
- ### dateRangePicker.show()
529
- Shows the picker
530
-
531
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
532
- **Emits**: <code>event:&quot;show.daterangepicker&quot;</code>
533
- <a name="DateRangePicker+hide"></a>
534
-
535
- ### dateRangePicker.hide()
536
- Hides the picker
537
-
538
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
539
- **Emits**: <code>event:&quot;beforeHide.daterangepicker&quot;</code>, <code>event:&quot;hide.daterangepicker&quot;</code>
540
- <a name="DateRangePicker+toggle"></a>
541
-
542
- ### dateRangePicker.toggle()
543
- Toggles visibility of the picker
544
-
545
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
546
- <a name="DateRangePicker+showCalendars"></a>
547
-
548
- ### dateRangePicker.showCalendars()
549
- Shows calendar when user selects "Custom Ranges"
550
-
551
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
552
- **Emits**: <code>event:&quot;showCalendar.daterangepicker&quot;</code>
553
- <a name="DateRangePicker+hideCalendars"></a>
554
-
555
- ### dateRangePicker.hideCalendars()
556
- Hides calendar when user selects a predefined range
557
-
558
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
559
- **Emits**: <code>event:&quot;hideCalendar.daterangepicker&quot;</code>
560
- <a name="DateRangePicker+updateElement"></a>
561
-
562
- ### dateRangePicker.updateElement()
563
- Update attached `<input>` element with selected value
564
-
565
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
566
- **Emits**: [<code>change</code>](https://api.jquery.com/change/)
567
- <a name="DateRangePicker+updateAltInput"></a>
568
-
569
- ### dateRangePicker.updateAltInput()
570
- Update altInput `<input>` element with selected value
571
-
572
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
573
- <a name="DateRangePicker+remove"></a>
574
-
575
- ### dateRangePicker.remove()
576
- Removes the picker from document
577
-
578
- **Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
579
- <a name="DateRangePicker.daterangepicker"></a>
580
-
581
- ### DateRangePicker.daterangepicker(options, callback) ⇒
582
- Initiate a new DateRangePicker
583
-
584
- **Kind**: static method of [<code>DateRangePicker</code>](#DateRangePicker)
585
- **Returns**: DateRangePicker
586
-
587
- | Param | Type | Description |
588
- | --- | --- | --- |
589
- | options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
590
- | 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 |
591
-
592
- <a name="event_violated.daterangepicker"></a>
593
-
594
- ## "violated.daterangepicker" (this, picker, result, newDate) ⇒ <code>boolean</code>
595
- Emitted when the date is changed through `<input>` element or via [setStartDate](#DateRangePicker+setStartDate) or
596
- [setRange](#DateRangePicker+setRange) and date is not valid due to
597
- `minDate`, `maxDate`, `minSpan`, `maxSpan`, `invalidDate` and `invalidTime` constraints.<br>
598
- Event is only triggered when date string is valid and date value is changing<br>
599
-
600
- **Kind**: event emitted
601
- **Returns**: <code>boolean</code> - =undefined - If handler returns `true`, then values from `newDate` object are used
602
-
603
- | Param | Type | Description |
604
- | --- | --- | --- |
605
- | this | <code>Object</code> | The event object |
606
- | picker | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
607
- | result | [<code>InputViolation</code>](#InputViolation) | The violation object, see example of `validateInput()` |
608
- | newDate | <code>Object</code> | Object of {startDate, endDate} |
609
-
610
- **Example**
611
- ```js
612
- $('#picker').daterangepicker({
613
- startDate: DateTime.now(),
614
- // allow only dates from current year
615
- minDate: DateTime.now().startOf('year'),
616
- manDate: DateTime.now().endOf('year'),
617
- singleDatePicker: true,
618
- locale: {
619
- format: DateTime.DATETIME_SHORT
620
- }
621
- }).on('violated.daterangepicker', (ev, picker, result, newDate) => {
622
- newDate.startDate = DateTime.now().minus({ days: 3 }).startOf('day');
623
- return true;
624
- });
625
-
626
- // Try to set date outside permitted range at <input> elemet
627
- $('#picker').val(DateTime.now().minus({ years: 10 })).toLocaleString(DateTime.DATETIME_SHORT).trigger('keyup');
628
- // Try to set date outside permitted range by code
629
- const drp = $('#picker').data('daterangepicker').setStartDate(DateTime.now().minus({ years: 10 })
630
-
631
- // -> Calendar selects and shows "today - 3 days"
632
- ```
633
- <a name="event_beforeRenderCalendar.daterangepicker"></a>
634
-
635
- ## "beforeRenderCalendar.daterangepicker" (this)
636
- Emitted before the calendar is rendered.
637
- Useful to remove any manually added elements.
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_beforeRenderTimePicker.daterangepicker"></a>
646
-
647
- ## "beforeRenderTimePicker.daterangepicker" (this)
648
- Emitted before the TimePicker is rendered.
649
- Useful to remove any manually added elements.
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_show.daterangepicker"></a>
658
-
659
- ## "show.daterangepicker" (this)
660
- Emitted when the picker is shown
661
-
662
- **Kind**: event emitted
663
-
664
- | Param | Type | Description |
665
- | --- | --- | --- |
666
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
667
-
668
- <a name="event_beforeHide.daterangepicker"></a>
669
-
670
- ## "beforeHide.daterangepicker" (this) ⇒ <code>boolean</code>
671
- Emitted before the picker will hide. When EventHandler returns `true`, then picker remains visible
672
-
673
- **Kind**: event emitted
674
- **Returns**: <code>boolean</code> - cancel - If `true`, then the picker remains visible
675
-
676
- | Param | Type | Description |
677
- | --- | --- | --- |
678
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
679
-
680
- <a name="event_hide.daterangepicker"></a>
681
-
682
- ## "hide.daterangepicker" (this)
683
- Emitted when the picker is hidden
684
-
685
- **Kind**: event emitted
686
-
687
- | Param | Type | Description |
688
- | --- | --- | --- |
689
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
690
-
691
- <a name="event_outsideClick.daterangepicker"></a>
692
-
693
- ## "outsideClick.daterangepicker" (this)
694
- Emitted when user clicks outside the picker.
695
- Use option `onOutsideClick` to define the default action, then you may not need to handle this event.
696
-
697
- **Kind**: event emitted
698
-
699
- | Param | Type | Description |
700
- | --- | --- | --- |
701
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
702
-
703
- <a name="event_showCalendar.daterangepicker"></a>
704
-
705
- ## "showCalendar.daterangepicker" (this)
706
- Emitted when the calendar(s) are shown.
707
- Only useful when [Ranges](#Ranges) are used.
708
-
709
- **Kind**: event emitted
710
-
711
- | Param | Type | Description |
712
- | --- | --- | --- |
713
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
714
-
715
- <a name="event_hideCalendar.daterangepicker"></a>
716
-
717
- ## "hideCalendar.daterangepicker" (this)
718
- Emitted when the calendar(s) are hidden.
719
- Only useful when [Ranges](#Ranges) are used.
720
-
721
- **Kind**: event emitted
722
-
723
- | Param | Type | Description |
724
- | --- | --- | --- |
725
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
726
-
727
- <a name="event_dateChange.daterangepicker"></a>
728
-
729
- ## "dateChange.daterangepicker" (this, side)
730
- Emitted when the date changed. Does not trigger when time is changed,
731
- use ["timeChange.daterangepicker"](#event_timeChange.daterangepicker) to handle it
732
-
733
- **Kind**: event emitted
734
-
735
- | Param | Type | Description |
736
- | --- | --- | --- |
737
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
738
- | side | <code>string</code> | Either `'start'` or `'end'` indicating whether startDate or endDate was changed. `null` when `singleDatePicker: true` |
739
-
740
- <a name="event_apply.daterangepicker"></a>
741
-
742
- ## "apply.daterangepicker" (this)
743
- Emitted when the `Apply` button is clicked, or when a predefined [Ranges](#Ranges) is clicked
744
-
745
- **Kind**: event emitted
746
-
747
- | Param | Type | Description |
748
- | --- | --- | --- |
749
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
750
-
751
- <a name="event_cancel.daterangepicker"></a>
752
-
753
- ## "cancel.daterangepicker" (this)
754
- Emitted when the `Cancel` button is clicked
755
-
756
- **Kind**: event emitted
757
-
758
- | Param | Type | Description |
759
- | --- | --- | --- |
760
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
761
-
762
- <a name="event_timeChange.daterangepicker"></a>
763
-
764
- ## "timeChange.daterangepicker" (this, side)
765
- Emitted when the time changed. Does not trigger when date is changed
766
-
767
- **Kind**: event emitted
768
-
769
- | Param | Type | Description |
770
- | --- | --- | --- |
771
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
772
- | side | <code>string</code> | Either `'start'` or `'end'` indicating whether startDate or endDate was changed |
773
-
774
- <a name="event_inputChanged.daterangepicker"></a>
775
-
776
- ## "inputChanged.daterangepicker" (this)
777
- Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid and date value has changed
778
-
779
- **Kind**: event emitted
780
-
781
- | Param | Type | Description |
782
- | --- | --- | --- |
783
- | this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
784
-
785
- <a name="Options"></a>
786
-
787
- ## Options
788
- Options for DateRangePicker
789
-
790
- **Kind**: global typedef
791
- **Properties**
792
-
793
- | Name | Type | Default | Description |
794
- | --- | --- | --- | --- |
795
- | 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 |
796
- | 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. |
797
- | 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> |
798
- | 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`. |
799
- | 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`. |
800
- | 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` |
801
- | 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` |
802
- | 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` |
803
- | 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` |
804
- | 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` |
805
- | 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> If `true`, then `endDate` is always `null`. |
806
- | 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`. |
807
- | showDropdowns | <code>boolean</code> | <code>false</code> | Show year and month select boxes above calendars to jump to a specific month and year |
808
- | minYear | <code>number</code> | | Default: `DateTime.now().minus({year:100}).year`<br>The minimum year shown in the dropdowns when `showDropdowns: true` |
809
- | maxYear | <code>number</code> | | Default: `DateTime.now().plus({year:100}).year`<br>The maximum year shown in the dropdowns when `showDropdowns: true` |
810
- | showWeekNumbers | <code>boolean</code> | <code>false</code> | Show **localized** week numbers at the start of each week on the calendars |
811
- | 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` |
812
- | timePicker | <code>boolean</code> | <code>false</code> | Adds select boxes to choose times in addition to dates |
813
- | 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). |
814
- | 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` |
815
- | timePickerSeconds | <code>boolean</code> | <code>boolean</code> | **Deprecated**, use `timePickerStepSize`<br>Show seconds in the timePicker |
816
- | timePickerIncrement | <code>boolean</code> | <code>1</code> | **Deprecated**, use `timePickerStepSize`<br>Increment of the minutes selection list for times |
817
- | 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`. |
818
- | 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. |
819
- | 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 |
820
- | 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> |
821
- | 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> Ensure that your function returns `false` for at least one item. Otherwise the calender is not rendered.<br> |
822
- | 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)` |
823
- | 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']` |
824
- | 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()` |
825
- | ~~warnings~~ | <code>boolean</code> | | Not used anymore. Listen to event `violated.daterangepicker` to react on invalid input data |
826
- | applyButtonClasses | <code>string</code> | <code>&quot;btn-primary&quot;</code> | CSS class names that will be added only to the apply button |
827
- | cancelButtonClasses | <code>string</code> | <code>&quot;btn-default&quot;</code> | CSS class names that will be added only to the cancel button |
828
- | buttonClasses | <code>string</code> | | Default: `'btn btn-sm'`<br>CSS class names that will be added to both the apply and cancel buttons. |
829
- | 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. |
830
- | 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. |
831
- | 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. |
832
- | externalStyle | <code>string</code> | <code>null</code> | External CSS Framework to style the picker. Currently only `'bulma'` is supported. |
833
- | 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'` |
834
- | 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'` |
835
- | 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. |
836
- | 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. |
837
- | 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. |
838
- | showLabel= | <code>boolean</code> | | Shows selected range next to Apply buttons.<br> Defaults to `false` if anchor element is `<input type="text">`, otherwise `true` |
839
- | 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. |
840
- | locale.direction | <code>string</code> | <code>&quot;ltr&quot;</code> | Direction of reading, `'ltr'` or `'rtl'` |
841
- | 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). |
842
- | locale.separator | <code>string</code> | | Defaut: `' - '`<br>Separator for start and end time |
843
- | locale.weekLabel | <code>string</code> | <code>&quot;W&quot;</code> | Label for week numbers |
844
- | locale.daysOfWeek | <code>Array</code> | | Default: `luxon.Info.weekdays('short')`<br>Array with weekday names, from Monday to Sunday |
845
- | locale.monthNames | <code>Array</code> | | Default: `luxon.Info.months('long')`<br>Array with month names |
846
- | locale.firstDay | <code>number</code> | | Default: `luxon.Info.getStartOfWeek()`<br>First day of the week, 1 for Monday through 7 for Sunday |
847
- | locale.applyLabel | <code>string</code> | <code>&quot;Apply&quot;</code> | Label of `Apply` Button |
848
- | locale.cancelLabel | <code>string</code> | <code>&quot;Cancel&quot;</code> | Label of `Cancel` Button |
849
- | locale.customRangeLabel | <code>string</code> | <code>&quot;Custom&quot;</code> | Range - Title for custom ranges |
850
- | 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) => {}` |
851
-
852
- <a name="Ranges"></a>
853
-
854
- ## Ranges : <code>Object</code>
855
- A set of predefined ranges.<br>
856
- Ranges are not validated against `minDate`, `maxDate`, `minSpan`, `maxSpan` or `timePickerStepSize ` constraints.
857
-
858
- **Kind**: global typedef
859
- **Properties**
860
-
861
- | Name | Type | Description |
862
- | --- | --- | --- |
863
- | name | <code>string</code> | The name of the range |
864
- | 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` |
865
-
866
- **Example**
867
- ```js
868
- {
869
- 'Today': [DateTime.now().startOf('day'), DateTime.now().endOf('day')],
870
- 'Yesterday': [DateTime.now().startOf('day').minus({days: 1}), DateTime.now().minus({days: 1}).endOf('day')],
871
- 'Last 7 Days': [DateTime.now().startOf('day').minus({days: 6}), DateTime.now()],
872
- 'Last 30 Days': [DateTime.now().startOf('day').minus({days: 29}), DateTime.now()],
873
- 'This Month': [DateTime.now().startOf('day').startOf('month'), DateTime.now().endOf('month')],
874
- 'Last Month': [DateTime.now().startOf('day').minus({months: 1}).startOf('month'), DateTime.now().minus({months: 1}).endOf('month')]
875
- }
876
- ```
877
- <a name="Range"></a>
878
-
879
- ## Range : <code>Object</code>
880
- A single predefined range
881
-
882
- **Kind**: global typedef
883
- **Properties**
884
-
885
- | Name | Type | Description |
886
- | --- | --- | --- |
887
- | name | <code>string</code> | The name of the range |
888
- | 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 |
889
-
890
- **Example**
891
- ```js
892
- { Today: [DateTime.now().startOf('day'), DateTime.now().endOf('day')] }
893
- ```
894
- <a name="InputViolation"></a>
895
-
896
- ## InputViolation : <code>Object</code>
897
- **Kind**: global typedef
898
- **Properties**
899
-
900
- | Name | Type | Description |
901
- | --- | --- | --- |
902
- | startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Violation of startDate |
903
- | endDate? | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| <code>undefined</code> | Violation of endDate, if existing |
904
- | violations | <code>Array</code> | The constraints which violates the input |
905
- | reason | <code>Array</code> | The type/reson of violation |
906
- | old | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Old value startDate/endDate |
907
- | new? | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Corrected value of startDate/endDate if existing |
908
-
909
- <a name="callback"></a>
910
-
911
- ## callback : <code>function</code>
912
- **Kind**: global typedef
913
-
914
- | Param | Type | Description |
915
- | --- | --- | --- |
916
- | startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Selected startDate |
917
- | endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Selected endDate |
918
- | range | <code>string</code> | |
919
-
258
+ ## API Documentation
259
+ [API Documentation](API_Doc.md)