@wernfried/daterangepicker 4.0.0 → 4.16.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/LICENSE +22 -0
- package/README.md +902 -1
- package/css/daterangepicker.bulma.css +439 -0
- package/css/daterangepicker.bulma.min.css +1 -0
- package/css/daterangepicker.css +457 -0
- package/css/daterangepicker.min.css +1 -0
- package/dist/esm/daterangepicker.js +2055 -0
- package/dist/esm/daterangepicker.min.js +2 -0
- package/dist/global/daterangepicker.js +2055 -0
- package/dist/global/daterangepicker.min.js +2 -0
- package/package.json +49 -3
- package/wernfried-daterangepicker-4.0.0.tgz +0 -0
package/README.md
CHANGED
|
@@ -1,4 +1,905 @@
|
|
|
1
1
|
# Date Range Picker
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
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
|
+

|
|
217
|
+
|
|
218
|
+

|
|
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, picker, result, newDate)</a> ⇒ <code>boolean</code></dt>
|
|
269
|
+
<dd><p>Emitted when the date is changed through <code><input></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.<br>
|
|
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">"timeChange.daterangepicker"</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><input></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
|
+
* [.setStartDate(startDate, updateView)](#DateRangePicker+setStartDate) ⇒ [<code>InputViolation</code>](#InputViolation)
|
|
349
|
+
* [.setEndDate(endDate, updateView)](#DateRangePicker+setEndDate) ⇒ [<code>InputViolation</code>](#InputViolation)
|
|
350
|
+
* [.setRange(startDate, endDate, updateView)](#DateRangePicker+setRange) ⇒ [<code>InputViolation</code>](#InputViolation)
|
|
351
|
+
* [.parseDate(value)](#DateRangePicker+parseDate) ⇒ [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
|
|
352
|
+
* [.formatDate(date, format)](#DateRangePicker+formatDate) ⇒ <code>string</code>
|
|
353
|
+
* [.validateInput([startDate, endDate], dipatch)](#DateRangePicker+validateInput) ⇒ [<code>InputViolation</code>](#InputViolation) \| <code>null</code>
|
|
354
|
+
* [.updateView()](#DateRangePicker+updateView)
|
|
355
|
+
* [.show()](#DateRangePicker+show)
|
|
356
|
+
* [.hide()](#DateRangePicker+hide)
|
|
357
|
+
* [.toggle()](#DateRangePicker+toggle)
|
|
358
|
+
* [.showCalendars()](#DateRangePicker+showCalendars)
|
|
359
|
+
* [.hideCalendars()](#DateRangePicker+hideCalendars)
|
|
360
|
+
* [.updateElement()](#DateRangePicker+updateElement)
|
|
361
|
+
* [.updateAltInput()](#DateRangePicker+updateAltInput)
|
|
362
|
+
* [.remove()](#DateRangePicker+remove)
|
|
363
|
+
* _static_
|
|
364
|
+
* [.daterangepicker(options, callback)](#DateRangePicker.daterangepicker) ⇒
|
|
365
|
+
|
|
366
|
+
<a name="new_DateRangePicker_new"></a>
|
|
367
|
+
|
|
368
|
+
### new DateRangePicker(element, options, cb)
|
|
369
|
+
|
|
370
|
+
| Param | Type | Description |
|
|
371
|
+
| --- | --- | --- |
|
|
372
|
+
| 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 |
|
|
373
|
+
| options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
|
|
374
|
+
| cb | <code>function</code> | Callback function executed when |
|
|
375
|
+
|
|
376
|
+
<a name="DateRangePicker+setStartDate"></a>
|
|
377
|
+
|
|
378
|
+
### dateRangePicker.setStartDate(startDate, updateView) ⇒ [<code>InputViolation</code>](#InputViolation)
|
|
379
|
+
Sets the date range picker's currently selected start date to the provided date.<br>
|
|
380
|
+
`startDate` must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or a string matching `locale.format`.<br>
|
|
381
|
+
Invalid date values are handled by [violated](#DateRangePicker+violated) Event
|
|
382
|
+
|
|
383
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
384
|
+
**Returns**: [<code>InputViolation</code>](#InputViolation) - - Object of violations or `null` if no violation have been found
|
|
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. In case of ranges, the current `endDate` is used. |
|
|
389
|
+
| updateView | <code>boolean</code> | <code>true</code> | If `true`, then calendar UI is updated to new value. Otherwise only internal values are set. |
|
|
390
|
+
|
|
391
|
+
**Example**
|
|
392
|
+
```js
|
|
393
|
+
const drp = $('#picker').data('daterangepicker');
|
|
394
|
+
drp.setStartDate(DateTime.now().startOf('hour'));
|
|
395
|
+
```
|
|
396
|
+
<a name="DateRangePicker+setEndDate"></a>
|
|
397
|
+
|
|
398
|
+
### dateRangePicker.setEndDate(endDate, updateView) ⇒ [<code>InputViolation</code>](#InputViolation)
|
|
399
|
+
Sets the date range picker's currently selected start date to the provided date.<br>
|
|
400
|
+
`endDate` must be a `luxon.DateTime` or `Date` or `string` according to [ISO-8601](ISO-8601) or a string matching `locale.format`.<br>
|
|
401
|
+
Invalid date values are handled by [violated](#DateRangePicker+violated) Event
|
|
402
|
+
|
|
403
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
404
|
+
**Returns**: [<code>InputViolation</code>](#InputViolation) - - Object of violations or `null` if no violation have been found
|
|
405
|
+
|
|
406
|
+
| Param | Type | Default | Description |
|
|
407
|
+
| --- | --- | --- | --- |
|
|
408
|
+
| 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. |
|
|
409
|
+
| updateView | <code>boolean</code> | <code>true</code> | If `true`, then calendar UI is updated to new value. Otherwise only internal values are set. |
|
|
410
|
+
|
|
411
|
+
**Example**
|
|
412
|
+
```js
|
|
413
|
+
const drp = $('#picker').data('daterangepicker');
|
|
414
|
+
drp.setEndDate(DateTime.now().startOf('hour'));
|
|
415
|
+
```
|
|
416
|
+
<a name="DateRangePicker+setRange"></a>
|
|
417
|
+
|
|
418
|
+
### dateRangePicker.setRange(startDate, endDate, updateView) ⇒ [<code>InputViolation</code>](#InputViolation)
|
|
419
|
+
Sets the date range picker's currently selected start date to the provided date.<br>
|
|
420
|
+
`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>
|
|
421
|
+
Invalid date values are handled by [violated](#DateRangePicker+violated) Event
|
|
422
|
+
|
|
423
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
424
|
+
**Returns**: [<code>InputViolation</code>](#InputViolation) - - Object of violations or `null` if no violation have been found
|
|
425
|
+
|
|
426
|
+
| Param | Type | Default | Description |
|
|
427
|
+
| --- | --- | --- | --- |
|
|
428
|
+
| 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 |
|
|
429
|
+
| 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 |
|
|
430
|
+
| updateView | <code>boolean</code> | <code>true</code> | If `true`, then calendar UI is updated to new value. Otherwise only internal values are set. |
|
|
431
|
+
|
|
432
|
+
**Example**
|
|
433
|
+
```js
|
|
434
|
+
const drp = $('#picker').data('daterangepicker');
|
|
435
|
+
drp.setRange(DateTime.now().startOf('hour'), DateTime.now().endOf('day'));
|
|
436
|
+
```
|
|
437
|
+
<a name="DateRangePicker+parseDate"></a>
|
|
438
|
+
|
|
439
|
+
### dateRangePicker.parseDate(value) ⇒ [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime)
|
|
440
|
+
Parse date value
|
|
441
|
+
|
|
442
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
443
|
+
**Returns**: [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) - - DateTime object
|
|
444
|
+
|
|
445
|
+
| Param | Type | Description |
|
|
446
|
+
| --- | --- | --- |
|
|
447
|
+
| 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 |
|
|
448
|
+
|
|
449
|
+
<a name="DateRangePicker+formatDate"></a>
|
|
450
|
+
|
|
451
|
+
### dateRangePicker.formatDate(date, format) ⇒ <code>string</code>
|
|
452
|
+
Format a DateTime object
|
|
453
|
+
|
|
454
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
455
|
+
**Returns**: <code>string</code> - - Formatted date string
|
|
456
|
+
|
|
457
|
+
| Param | Type | Default | Description |
|
|
458
|
+
| --- | --- | --- | --- |
|
|
459
|
+
| date | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | | The DateTime to format |
|
|
460
|
+
| format | <code>object</code> \| <code>string</code> | <code>this.locale.format</code> | The format option |
|
|
461
|
+
|
|
462
|
+
<a name="DateRangePicker+validateInput"></a>
|
|
463
|
+
|
|
464
|
+
### dateRangePicker.validateInput([startDate, endDate], dipatch) ⇒ [<code>InputViolation</code>](#InputViolation) \| <code>null</code>
|
|
465
|
+
Validate `startDate` and `endDate` against `timePickerStepSize`, `minDate`, `maxDate`,
|
|
466
|
+
`minSpan`, `maxSpan`, `invalidDate` and `invalidTime`.
|
|
467
|
+
|
|
468
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
469
|
+
**Returns**: [<code>InputViolation</code>](#InputViolation) \| <code>null</code> - - Object of violations and corrected values or `null` if no violation have been found
|
|
470
|
+
**Emits**: <code>event:"violated.daterangepicker"</code>
|
|
471
|
+
|
|
472
|
+
| Param | Type | Default | Description |
|
|
473
|
+
| --- | --- | --- | --- |
|
|
474
|
+
| [startDate, endDate] | <code>Array</code> | | Range to be checked, defaults to current `startDate` and `endDate` |
|
|
475
|
+
| 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. |
|
|
476
|
+
|
|
477
|
+
**Example**
|
|
478
|
+
```js
|
|
479
|
+
options => {
|
|
480
|
+
minDate: DateTime.now().minus({months: 3}).startOf('day'),
|
|
481
|
+
maxDate: DateTime.now().minus({day: 3}).startOf('day'),
|
|
482
|
+
minSpan: Duration.fromObject({days: 7}),
|
|
483
|
+
maxSpan: Duration.fromObject({days: 70}),
|
|
484
|
+
timePickerStepSize: Duration.fromObject({hours: 1})
|
|
485
|
+
}
|
|
486
|
+
const result = validateInput(DateTime.now(), DateTime.now().plus({day: 3}));
|
|
487
|
+
|
|
488
|
+
result => {
|
|
489
|
+
startDate: {
|
|
490
|
+
violations: [
|
|
491
|
+
{ old: "2026-03-13T10:35:52", reason: "timePickerStepSize", new: "2026-03-13T11:00:00" },
|
|
492
|
+
{ old: "2026-03-13T11:00:00", reason: "maxDate", new: "2026-03-10T00:00:00" }
|
|
493
|
+
]
|
|
494
|
+
},
|
|
495
|
+
endDate: {
|
|
496
|
+
violations: [
|
|
497
|
+
{ old: "2026-03-16T10:35:52", reason: "stepSize", new: "2026-03-16T11:00:00" },
|
|
498
|
+
{ old: "2026-03-16T11:00:00", reason: "maxDate", new: "2026-03-10T00:00:00" },
|
|
499
|
+
{ old: "2026-03-10T00:00:00", reason: "minSpan", new: "2026-03-17T00:00:00" }
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
```
|
|
504
|
+
<a name="DateRangePicker+updateView"></a>
|
|
505
|
+
|
|
506
|
+
### dateRangePicker.updateView()
|
|
507
|
+
Updates the picker when calendar is initiated or any date has been selected.
|
|
508
|
+
Could be useful after running [setStartDate](#DateRangePicker+setStartDate) or [setRange](#DateRangePicker+setEndDate)
|
|
509
|
+
|
|
510
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
511
|
+
**Emits**: <code>event:"beforeRenderTimePicker.daterangepicker"</code>
|
|
512
|
+
<a name="DateRangePicker+show"></a>
|
|
513
|
+
|
|
514
|
+
### dateRangePicker.show()
|
|
515
|
+
Shows the picker
|
|
516
|
+
|
|
517
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
518
|
+
**Emits**: <code>event:"show.daterangepicker"</code>
|
|
519
|
+
<a name="DateRangePicker+hide"></a>
|
|
520
|
+
|
|
521
|
+
### dateRangePicker.hide()
|
|
522
|
+
Hides the picker
|
|
523
|
+
|
|
524
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
525
|
+
**Emits**: <code>event:"beforeHide.daterangepicker"</code>, <code>event:"hide.daterangepicker"</code>
|
|
526
|
+
<a name="DateRangePicker+toggle"></a>
|
|
527
|
+
|
|
528
|
+
### dateRangePicker.toggle()
|
|
529
|
+
Toggles visibility of the picker
|
|
530
|
+
|
|
531
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
532
|
+
<a name="DateRangePicker+showCalendars"></a>
|
|
533
|
+
|
|
534
|
+
### dateRangePicker.showCalendars()
|
|
535
|
+
Shows calendar when user selects "Custom Ranges"
|
|
536
|
+
|
|
537
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
538
|
+
**Emits**: <code>event:"showCalendar.daterangepicker"</code>
|
|
539
|
+
<a name="DateRangePicker+hideCalendars"></a>
|
|
540
|
+
|
|
541
|
+
### dateRangePicker.hideCalendars()
|
|
542
|
+
Hides calendar when user selects a predefined range
|
|
543
|
+
|
|
544
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
545
|
+
**Emits**: <code>event:"hideCalendar.daterangepicker"</code>
|
|
546
|
+
<a name="DateRangePicker+updateElement"></a>
|
|
547
|
+
|
|
548
|
+
### dateRangePicker.updateElement()
|
|
549
|
+
Update attached `<input>` element with selected value
|
|
550
|
+
|
|
551
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
552
|
+
**Emits**: [<code>change</code>](https://api.jquery.com/change/)
|
|
553
|
+
<a name="DateRangePicker+updateAltInput"></a>
|
|
554
|
+
|
|
555
|
+
### dateRangePicker.updateAltInput()
|
|
556
|
+
Update altInput `<input>` element with selected value
|
|
557
|
+
|
|
558
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
559
|
+
<a name="DateRangePicker+remove"></a>
|
|
560
|
+
|
|
561
|
+
### dateRangePicker.remove()
|
|
562
|
+
Removes the picker from document
|
|
563
|
+
|
|
564
|
+
**Kind**: instance method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
565
|
+
<a name="DateRangePicker.daterangepicker"></a>
|
|
566
|
+
|
|
567
|
+
### DateRangePicker.daterangepicker(options, callback) ⇒
|
|
568
|
+
Initiate a new DateRangePicker
|
|
569
|
+
|
|
570
|
+
**Kind**: static method of [<code>DateRangePicker</code>](#DateRangePicker)
|
|
571
|
+
**Returns**: DateRangePicker
|
|
572
|
+
|
|
573
|
+
| Param | Type | Description |
|
|
574
|
+
| --- | --- | --- |
|
|
575
|
+
| options | [<code>Options</code>](#Options) | Object to configure the DateRangePicker |
|
|
576
|
+
| 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 |
|
|
577
|
+
|
|
578
|
+
<a name="event_violated.daterangepicker"></a>
|
|
579
|
+
|
|
580
|
+
## "violated.daterangepicker" (this, picker, result, newDate) ⇒ <code>boolean</code>
|
|
581
|
+
Emitted when the date is changed through `<input>` element or via [setStartDate](#DateRangePicker+setStartDate) or
|
|
582
|
+
[setRange](#DateRangePicker+setRange) and date is not valid due to.<br>
|
|
583
|
+
`minDate`, `maxDate`, `minSpan`, `maxSpan`, `invalidDate` and `invalidTime` constraints.<br>
|
|
584
|
+
Event is only triggered when date string is valid and date value is changing<br>
|
|
585
|
+
|
|
586
|
+
**Kind**: event emitted
|
|
587
|
+
**Returns**: <code>boolean</code> - =undefined - If handler returns `true`, then values from `newDate` object are used
|
|
588
|
+
|
|
589
|
+
| Param | Type | Description |
|
|
590
|
+
| --- | --- | --- |
|
|
591
|
+
| this | <code>Object</code> | The event object |
|
|
592
|
+
| picker | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
593
|
+
| result | [<code>InputViolation</code>](#InputViolation) | The violation object, see example of `validateInput()` |
|
|
594
|
+
| newDate | <code>Object</code> | Object of {startDate, endDate} |
|
|
595
|
+
|
|
596
|
+
**Example**
|
|
597
|
+
```js
|
|
598
|
+
$('#picker').daterangepicker({
|
|
599
|
+
startDate: DateTime.now(),
|
|
600
|
+
// allow only dates from current year
|
|
601
|
+
minDate: DateTime.now().startOf('year'),
|
|
602
|
+
manDate: DateTime.now().endOf('year'),
|
|
603
|
+
singleDatePicker: true,
|
|
604
|
+
locale: {
|
|
605
|
+
format: DateTime.DATETIME_SHORT
|
|
606
|
+
}
|
|
607
|
+
}).on('violated.daterangepicker', (ev, picker, result, newDate) => {
|
|
608
|
+
newDate.startDate = DateTime.now().minus({ days: 3 }).startOf('day');
|
|
609
|
+
return true;
|
|
610
|
+
});
|
|
611
|
+
|
|
612
|
+
// Try to set date outside permitted range at <input> elemet
|
|
613
|
+
$('#picker').val(DateTime.now().minus({ years: 10 })).toLocaleString(DateTime.DATETIME_SHORT).trigger('keyup');
|
|
614
|
+
// Try to set date outside permitted range by code
|
|
615
|
+
const drp = $('#picker').data('daterangepicker').setStartDate(DateTime.now().minus({ years: 10 })
|
|
616
|
+
|
|
617
|
+
-> Calendar selects and shows "today - 3 days"
|
|
618
|
+
```
|
|
619
|
+
<a name="event_beforeRenderCalendar.daterangepicker"></a>
|
|
620
|
+
|
|
621
|
+
## "beforeRenderCalendar.daterangepicker" (this)
|
|
622
|
+
Emitted before the calendar is rendered.
|
|
623
|
+
Useful to remove any manually added elements.
|
|
624
|
+
|
|
625
|
+
**Kind**: event emitted
|
|
626
|
+
|
|
627
|
+
| Param | Type | Description |
|
|
628
|
+
| --- | --- | --- |
|
|
629
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
630
|
+
|
|
631
|
+
<a name="event_beforeRenderTimePicker.daterangepicker"></a>
|
|
632
|
+
|
|
633
|
+
## "beforeRenderTimePicker.daterangepicker" (this)
|
|
634
|
+
Emitted before the TimePicker is rendered.
|
|
635
|
+
Useful to remove any manually added elements.
|
|
636
|
+
|
|
637
|
+
**Kind**: event emitted
|
|
638
|
+
|
|
639
|
+
| Param | Type | Description |
|
|
640
|
+
| --- | --- | --- |
|
|
641
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
642
|
+
|
|
643
|
+
<a name="event_show.daterangepicker"></a>
|
|
644
|
+
|
|
645
|
+
## "show.daterangepicker" (this)
|
|
646
|
+
Emitted when the picker is shown
|
|
647
|
+
|
|
648
|
+
**Kind**: event emitted
|
|
649
|
+
|
|
650
|
+
| Param | Type | Description |
|
|
651
|
+
| --- | --- | --- |
|
|
652
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
653
|
+
|
|
654
|
+
<a name="event_beforeHide.daterangepicker"></a>
|
|
655
|
+
|
|
656
|
+
## "beforeHide.daterangepicker" (this) ⇒ <code>boolean</code>
|
|
657
|
+
Emitted before the picker will hide. When EventHandler returns `true`, then picker remains visible
|
|
658
|
+
|
|
659
|
+
**Kind**: event emitted
|
|
660
|
+
**Returns**: <code>boolean</code> - cancel - If `true`, then the picker remains visible
|
|
661
|
+
|
|
662
|
+
| Param | Type | Description |
|
|
663
|
+
| --- | --- | --- |
|
|
664
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
665
|
+
|
|
666
|
+
<a name="event_hide.daterangepicker"></a>
|
|
667
|
+
|
|
668
|
+
## "hide.daterangepicker" (this)
|
|
669
|
+
Emitted when the picker is hidden
|
|
670
|
+
|
|
671
|
+
**Kind**: event emitted
|
|
672
|
+
|
|
673
|
+
| Param | Type | Description |
|
|
674
|
+
| --- | --- | --- |
|
|
675
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
676
|
+
|
|
677
|
+
<a name="event_outsideClick.daterangepicker"></a>
|
|
678
|
+
|
|
679
|
+
## "outsideClick.daterangepicker" (this)
|
|
680
|
+
Emitted when user clicks outside the picker.
|
|
681
|
+
Use option `onOutsideClick` to define the default action, then you may not need to handle this event.
|
|
682
|
+
|
|
683
|
+
**Kind**: event emitted
|
|
684
|
+
|
|
685
|
+
| Param | Type | Description |
|
|
686
|
+
| --- | --- | --- |
|
|
687
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
688
|
+
|
|
689
|
+
<a name="event_showCalendar.daterangepicker"></a>
|
|
690
|
+
|
|
691
|
+
## "showCalendar.daterangepicker" (this)
|
|
692
|
+
Emitted when the calendar(s) are shown.
|
|
693
|
+
Only useful when [Ranges](#Ranges) are used.
|
|
694
|
+
|
|
695
|
+
**Kind**: event emitted
|
|
696
|
+
|
|
697
|
+
| Param | Type | Description |
|
|
698
|
+
| --- | --- | --- |
|
|
699
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
700
|
+
|
|
701
|
+
<a name="event_hideCalendar.daterangepicker"></a>
|
|
702
|
+
|
|
703
|
+
## "hideCalendar.daterangepicker" (this)
|
|
704
|
+
Emitted when the calendar(s) are hidden.
|
|
705
|
+
Only useful when [Ranges](#Ranges) are used.
|
|
706
|
+
|
|
707
|
+
**Kind**: event emitted
|
|
708
|
+
|
|
709
|
+
| Param | Type | Description |
|
|
710
|
+
| --- | --- | --- |
|
|
711
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
712
|
+
|
|
713
|
+
<a name="event_dateChange.daterangepicker"></a>
|
|
714
|
+
|
|
715
|
+
## "dateChange.daterangepicker" (this, side)
|
|
716
|
+
Emitted when the date changed. Does not trigger when time is changed,
|
|
717
|
+
use ["timeChange.daterangepicker"](#event_timeChange.daterangepicker) to handle it
|
|
718
|
+
|
|
719
|
+
**Kind**: event emitted
|
|
720
|
+
|
|
721
|
+
| Param | Type | Description |
|
|
722
|
+
| --- | --- | --- |
|
|
723
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
724
|
+
| side | <code>string</code> | Either `'start'` or `'end'` indicating whether startDate or endDate was changed. `null` when `singleDatePicker: true` |
|
|
725
|
+
|
|
726
|
+
<a name="event_apply.daterangepicker"></a>
|
|
727
|
+
|
|
728
|
+
## "apply.daterangepicker" (this)
|
|
729
|
+
Emitted when the `Apply` button is clicked, or when a predefined [Ranges](#Ranges) is clicked
|
|
730
|
+
|
|
731
|
+
**Kind**: event emitted
|
|
732
|
+
|
|
733
|
+
| Param | Type | Description |
|
|
734
|
+
| --- | --- | --- |
|
|
735
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
736
|
+
|
|
737
|
+
<a name="event_cancel.daterangepicker"></a>
|
|
738
|
+
|
|
739
|
+
## "cancel.daterangepicker" (this)
|
|
740
|
+
Emitted when the `Cancel` button is clicked
|
|
741
|
+
|
|
742
|
+
**Kind**: event emitted
|
|
743
|
+
|
|
744
|
+
| Param | Type | Description |
|
|
745
|
+
| --- | --- | --- |
|
|
746
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
747
|
+
|
|
748
|
+
<a name="event_timeChange.daterangepicker"></a>
|
|
749
|
+
|
|
750
|
+
## "timeChange.daterangepicker" (this, side)
|
|
751
|
+
Emitted when the time changed. Does not trigger when date is changed
|
|
752
|
+
|
|
753
|
+
**Kind**: event emitted
|
|
754
|
+
|
|
755
|
+
| Param | Type | Description |
|
|
756
|
+
| --- | --- | --- |
|
|
757
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
758
|
+
| side | <code>string</code> | Either `'start'` or `'end'` indicating whether startDate or endDate was changed |
|
|
759
|
+
|
|
760
|
+
<a name="event_inputChanged.daterangepicker"></a>
|
|
761
|
+
|
|
762
|
+
## "inputChanged.daterangepicker" (this)
|
|
763
|
+
Emitted when the date is changed through `<input>` element. Event is only triggered when date string is valid and date value has changed
|
|
764
|
+
|
|
765
|
+
**Kind**: event emitted
|
|
766
|
+
|
|
767
|
+
| Param | Type | Description |
|
|
768
|
+
| --- | --- | --- |
|
|
769
|
+
| this | [<code>DateRangePicker</code>](#DateRangePicker) | The daterangepicker object |
|
|
770
|
+
|
|
771
|
+
<a name="Options"></a>
|
|
772
|
+
|
|
773
|
+
## Options
|
|
774
|
+
Options for DateRangePicker
|
|
775
|
+
|
|
776
|
+
**Kind**: global typedef
|
|
777
|
+
**Properties**
|
|
778
|
+
|
|
779
|
+
| Name | Type | Default | Description |
|
|
780
|
+
| --- | --- | --- | --- |
|
|
781
|
+
| parentEl | <code>string</code> | <code>"body"</code> | [jQuery selector](https://api.jquery.com/category/selectors/) of the parent element that the date range picker will be added to |
|
|
782
|
+
| 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. |
|
|
783
|
+
| 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> |
|
|
784
|
+
| 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`. |
|
|
785
|
+
| 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`. |
|
|
786
|
+
| 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` |
|
|
787
|
+
| 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` |
|
|
788
|
+
| 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` |
|
|
789
|
+
| 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` |
|
|
790
|
+
| 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` |
|
|
791
|
+
| 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`. |
|
|
792
|
+
| 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`. |
|
|
793
|
+
| showDropdowns | <code>boolean</code> | <code>false</code> | Show year and month select boxes above calendars to jump to a specific month and year |
|
|
794
|
+
| minYear | <code>number</code> | | Default: `DateTime.now().minus({year:100}).year`<br>The minimum year shown in the dropdowns when `showDropdowns: true` |
|
|
795
|
+
| maxYear | <code>number</code> | | Default: `DateTime.now().plus({year:100}).year`<br>The maximum year shown in the dropdowns when `showDropdowns: true` |
|
|
796
|
+
| showWeekNumbers | <code>boolean</code> | <code>false</code> | Show **localized** week numbers at the start of each week on the calendars |
|
|
797
|
+
| 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` |
|
|
798
|
+
| timePicker | <code>boolean</code> | <code>false</code> | Adds select boxes to choose times in addition to dates |
|
|
799
|
+
| 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). |
|
|
800
|
+
| 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` |
|
|
801
|
+
| timePickerSeconds | <code>boolean</code> | <code>boolean</code> | **Deprecated**, use `timePickerStepSize`<br>Show seconds in the timePicker |
|
|
802
|
+
| timePickerIncrement | <code>boolean</code> | <code>1</code> | **Deprecated**, use `timePickerStepSize`<br>Increment of the minutes selection list for times |
|
|
803
|
+
| 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`. |
|
|
804
|
+
| onOutsideClick | <code>string</code> | <code>"apply"</code> | Defines what picker shall do when user clicks outside the calendar. `'apply'` or `'cancel'`. Event [onOutsideClick.daterangepicker](#event_outsideClick.daterangepicker) is always emitted. |
|
|
805
|
+
| 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 |
|
|
806
|
+
| 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> |
|
|
807
|
+
| 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> |
|
|
808
|
+
| 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)` |
|
|
809
|
+
| 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']` |
|
|
810
|
+
| 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()` |
|
|
811
|
+
| ~~warnings~~ | <code>boolean</code> | | Not used anymore. Listen to event `violated.daterangepicker` to react on invalid input data |
|
|
812
|
+
| applyButtonClasses | <code>string</code> | <code>"btn-primary"</code> | CSS class names that will be added only to the apply button |
|
|
813
|
+
| cancelButtonClasses | <code>string</code> | <code>"btn-default"</code> | CSS class names that will be added only to the cancel button |
|
|
814
|
+
| buttonClasses | <code>string</code> | | Default: `'btn btn-sm'`<br>CSS class names that will be added to both the apply and cancel buttons. |
|
|
815
|
+
| weekendClasses | <code>string</code> | <code>"weekend"</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. |
|
|
816
|
+
| weekendDayClasses | <code>string</code> | <code>"weekend-day"</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. |
|
|
817
|
+
| todayClasses | <code>string</code> | <code>"today"</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. |
|
|
818
|
+
| externalStyle | <code>string</code> | <code>null</code> | External CSS Framework to style the picker. Currently only `'bulma'` is supported. |
|
|
819
|
+
| opens | <code>string</code> | <code>"right"</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'` |
|
|
820
|
+
| drops | <code>string</code> | <code>"down"</code> | Whether the picker appears below or above the HTML element it's attached to.<br> `'down' \| 'up' \| 'auto'` |
|
|
821
|
+
| 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. |
|
|
822
|
+
| 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. |
|
|
823
|
+
| 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. |
|
|
824
|
+
| showLabel= | <code>boolean</code> | | Shows selected range next to Apply buttons.<br> Defaults to `false` if anchor element is `<input type="text">`, otherwise `true` |
|
|
825
|
+
| 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. |
|
|
826
|
+
| locale.direction | <code>string</code> | <code>"ltr"</code> | Direction of reading, `'ltr'` or `'rtl'` |
|
|
827
|
+
| 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). |
|
|
828
|
+
| locale.separator | <code>string</code> | | Defaut: `' - '`<br>Separator for start and end time |
|
|
829
|
+
| locale.weekLabel | <code>string</code> | <code>"W"</code> | Label for week numbers |
|
|
830
|
+
| locale.daysOfWeek | <code>Array</code> | | Default: `luxon.Info.weekdays('short')`<br>Array with weekday names, from Monday to Sunday |
|
|
831
|
+
| locale.monthNames | <code>Array</code> | | Default: `luxon.Info.months('long')`<br>Array with month names |
|
|
832
|
+
| locale.firstDay | <code>number</code> | | Default: `luxon.Info.getStartOfWeek()`<br>First day of the week, 1 for Monday through 7 for Sunday |
|
|
833
|
+
| locale.applyLabel | <code>string</code> | <code>"Apply"</code> | Label of `Apply` Button |
|
|
834
|
+
| locale.cancelLabel | <code>string</code> | <code>"Cancel"</code> | Label of `Cancel` Button |
|
|
835
|
+
| locale.customRangeLabel | <code>string</code> | <code>"Custom"</code> | Range - Title for custom ranges |
|
|
836
|
+
| 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) => {}` |
|
|
837
|
+
|
|
838
|
+
<a name="Ranges"></a>
|
|
839
|
+
|
|
840
|
+
## Ranges : <code>Object</code>
|
|
841
|
+
A set of predefined ranges.<br>
|
|
842
|
+
Ranges are not validated against `minDate`, `maxDate`, `minSpan`, `maxSpan` or `timePickerStepSize ` constraints.
|
|
843
|
+
|
|
844
|
+
**Kind**: global typedef
|
|
845
|
+
**Properties**
|
|
846
|
+
|
|
847
|
+
| Name | Type | Description |
|
|
848
|
+
| --- | --- | --- |
|
|
849
|
+
| name | <code>string</code> | The name of the range |
|
|
850
|
+
| 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` |
|
|
851
|
+
|
|
852
|
+
**Example**
|
|
853
|
+
```js
|
|
854
|
+
{
|
|
855
|
+
'Today': [DateTime.now().startOf('day'), DateTime.now().endOf('day')],
|
|
856
|
+
'Yesterday': [DateTime.now().startOf('day').minus({days: 1}), DateTime.now().minus({days: 1}).endOf('day')],
|
|
857
|
+
'Last 7 Days': [DateTime.now().startOf('day').minus({days: 6}), DateTime.now()],
|
|
858
|
+
'Last 30 Days': [DateTime.now().startOf('day').minus({days: 29}), DateTime.now()],
|
|
859
|
+
'This Month': [DateTime.now().startOf('day').startOf('month'), DateTime.now().endOf('month')],
|
|
860
|
+
'Last Month': [DateTime.now().startOf('day').minus({months: 1}).startOf('month'), DateTime.now().minus({months: 1}).endOf('month')]
|
|
861
|
+
}
|
|
862
|
+
```
|
|
863
|
+
<a name="Range"></a>
|
|
864
|
+
|
|
865
|
+
## Range : <code>Object</code>
|
|
866
|
+
A single predefined range
|
|
867
|
+
|
|
868
|
+
**Kind**: global typedef
|
|
869
|
+
**Properties**
|
|
870
|
+
|
|
871
|
+
| Name | Type | Description |
|
|
872
|
+
| --- | --- | --- |
|
|
873
|
+
| name | <code>string</code> | The name of the range |
|
|
874
|
+
| 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 |
|
|
875
|
+
|
|
876
|
+
**Example**
|
|
877
|
+
```js
|
|
878
|
+
{ Today: [DateTime.now().startOf('day'), DateTime.now().endOf('day')] }
|
|
879
|
+
```
|
|
880
|
+
<a name="InputViolation"></a>
|
|
881
|
+
|
|
882
|
+
## InputViolation : <code>Object</code>
|
|
883
|
+
**Kind**: global typedef
|
|
884
|
+
**Properties**
|
|
885
|
+
|
|
886
|
+
| Name | Type | Description |
|
|
887
|
+
| --- | --- | --- |
|
|
888
|
+
| startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Violation of startDate |
|
|
889
|
+
| ? | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) \| <code>undefined</code> | endDate - Violation of endDate, if existing |
|
|
890
|
+
| violations | <code>Array</code> | The constraints which violates the input |
|
|
891
|
+
| reason | <code>Array</code> | The type/reson of violation |
|
|
892
|
+
| old | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Old value startDate/endDate |
|
|
893
|
+
| ? | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | new - Corrected value of startDate/endDate if existing |
|
|
894
|
+
|
|
895
|
+
<a name="callback"></a>
|
|
896
|
+
|
|
897
|
+
## callback : <code>function</code>
|
|
898
|
+
**Kind**: global typedef
|
|
899
|
+
|
|
900
|
+
| Param | Type | Description |
|
|
901
|
+
| --- | --- | --- |
|
|
902
|
+
| startDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Selected startDate |
|
|
903
|
+
| endDate | [<code>DateTime</code>](https://moment.github.io/luxon/api-docs/index.html#datetime) | Selected endDate |
|
|
904
|
+
| range | <code>string</code> | |
|
|
4
905
|
|