daterangepicker-4.x 4.1.6 → 4.1.7
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 +12 -9
- package/daterangepicker.js +6 -4
- package/package.json +17 -2
- package/bower.json +0 -20
- package/demo.html +0 -411
- package/drp.png +0 -0
- package/example/amd/index.html +0 -210
- package/example/amd/main.js +0 -141
- package/example/amd/require.js +0 -36
- package/example/browserify/README.md +0 -11
- package/example/browserify/bundle.js +0 -0
- package/example/browserify/index.html +0 -209
- package/example/browserify/main.js +0 -135
- package/index.html +0 -82
- package/website/index.html +0 -745
- package/website/website.css +0 -152
- package/website/website.js +0 -179
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ Above samples are based on the [original repository](https://github.com/dangross
|
|
|
18
18
|
```html
|
|
19
19
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/jquery/latest/jquery.min.js"></script>
|
|
20
20
|
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
21
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@
|
|
22
|
-
<link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@
|
|
21
|
+
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.1.7/daterangepicker.min.js"></script>
|
|
22
|
+
<link type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker-4.x@4.1.7/daterangepicker.min.css" rel="stylesheet" />
|
|
23
23
|
|
|
24
24
|
<input type="text" id="daterange" />
|
|
25
25
|
|
|
@@ -100,18 +100,21 @@ isInvalidDate: function(date) {
|
|
|
100
100
|
}
|
|
101
101
|
```
|
|
102
102
|
### Features
|
|
103
|
-
Compared to [inital repository](https://github.com/dangrossman/daterangepicker), this fork added following features:
|
|
103
|
+
Compared to [inital repository](https://github.com/dangrossman/daterangepicker), this fork added following features and changes:
|
|
104
104
|
|
|
105
|
+
- Replaced [moment](https://momentjs.com/) by [luxon](https://moment.github.io/luxon/index.html) (see differences below)
|
|
105
106
|
- Added CSS class `weekend-day` for weekend days in calendar
|
|
106
107
|
- Added option `timePickerStepSize` to succeed options `timePickerIncrement` and `timePickerSeconds`
|
|
107
|
-
- Added events
|
|
108
|
-
- Added
|
|
108
|
+
- Added events `dateChange.daterangepicker` and `timeChange.daterangepicker` emitted when user clicks on a date/time
|
|
109
|
+
- Added event `beforeHide.daterangepicker` enables you to keep the picker visible after click on `Apply` or `Cancel` button.
|
|
110
|
+
- Added method `setRange(startDate, endDate)` to combine `setStartDate(startDate)` and `setEndDate(endDate)`
|
|
109
111
|
- Added option `minSpan` similar to `maxSpan`
|
|
110
112
|
- Added option `isInvalidTime` similar to `isInvalidDate`
|
|
111
113
|
- Added option `onOutsideClick` where you can define whether picker shall apply or revert selected value
|
|
112
|
-
-
|
|
113
|
-
- Better validation of input parameters, error are logged to console
|
|
114
|
+
- Better validation of input parameters, errors are logged to console
|
|
114
115
|
- Highlight range in calendar when hovering over pre-defined ranges
|
|
116
|
+
- Option `autoUpdateInput` defines whether the attached `<input>` element is updated when the user clicks on a date value.<br/>
|
|
117
|
+
In original daterangepicker this parameter defines whether the `<input>` is updated when the user clicks on `Apply` button.
|
|
115
118
|
- Added option `locale.durationFormat` to show customized label for selected duration, e.g. `'4 Days, 6 Hours, 30 Minutes'`
|
|
116
119
|
- ... and maybe some new bugs 😉
|
|
117
120
|
|
|
@@ -127,7 +130,7 @@ This table lists a few important differences between datarangepicker using momen
|
|
|
127
130
|
| from ISO-8601 String | `moment(...)` | `DateIme.fromISO(...)` |
|
|
128
131
|
| from [Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) Object | `moment(...)` | `DateIme.fromJSDate(...)` |
|
|
129
132
|
| current day | `moment()` | `DateTime.now()` |
|
|
130
|
-
| format to string | `format(...)
|
|
133
|
+
| format to string | `format(...)` | `toFormat(...)` |
|
|
131
134
|
| format tokens | `'YYYY-MM-DD'` | `'yyyy-MM-dd'` |
|
|
132
135
|
|
|
133
136
|
|
|
@@ -485,7 +488,7 @@ Options for DateRangePicker
|
|
|
485
488
|
| timePickerStepSize | [<code>Duration</code>](https://moment.github.io/luxon/api-docs/index.html#duration) \| <code>string</code> | | Default: `Duration.fromObject({minutes:1})`<br/>Set the time picker step size.<br/> Must be a `luxon.Duration` or number of seconds or a string according to [ISO-8601](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 |
|
|
486
489
|
| timePickerSeconds | <code>boolean</code> | <code>boolean</code> | **Deprecated**, use `timePickerStepSize`<br/>Show seconds in the timePicker |
|
|
487
490
|
| timePickerIncrement | <code>boolean</code> | <code>1</code> | **Deprecated**, use `timePickerStepSize`<br/>Increment of the minutes selection list for times |
|
|
488
|
-
| autoUpdateInput | <code>boolean</code> | <code>true</code> | Indicates whether the date range picker should
|
|
491
|
+
| 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`. |
|
|
489
492
|
| onOutsideClick | <code>string</code> | <code>"none"</code> | Defines what picker shall do when user clicks outside the calendar. `'apply'` or `'cancel'`. Event [onOutsideClick.daterangepicker](#event_outsideClick.daterangepicker) is always emitted. |
|
|
490
493
|
| 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 |
|
|
491
494
|
| 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)` Function has no effect on date values set by `startDate`, `endDate`, `ranges`, [setStartDate](#DateRangePicker+setStartDate), [setEndDate](#DateRangePicker+setEndDate). |
|
package/daterangepicker.js
CHANGED
|
@@ -83,8 +83,8 @@
|
|
|
83
83
|
* @property {boolean} timePickerSeconds=boolean - **Deprecated**, use `timePickerStepSize`<br/>Show seconds in the timePicker
|
|
84
84
|
* @property {boolean} timePickerIncrement=1 - **Deprecated**, use `timePickerStepSize`<br/>Increment of the minutes selection list for times
|
|
85
85
|
|
|
86
|
-
* @property {boolean} autoUpdateInput=true - Indicates whether the date range picker should
|
|
87
|
-
* element
|
|
86
|
+
* @property {boolean} autoUpdateInput=true - Indicates whether the date range picker should instantly update the value of the attached `<input>`
|
|
87
|
+
* element when the selected dates change.<br/>The `<input>` element will be always updated on `Apply` and reverted when user clicks on `Cancel`.
|
|
88
88
|
* @property {string} onOutsideClick=none - Defines what picker shall do when user clicks outside the calendar.
|
|
89
89
|
* `'apply'` or `'cancel'`. Event {@link #event_outsideClick.daterangepicker|onOutsideClick.daterangepicker} is always emitted.
|
|
90
90
|
* @property {boolean} linkedCalendars=true - When enabled, the two calendars displayed will always be for two sequential months (i.e. January and February),
|
|
@@ -1158,11 +1158,13 @@
|
|
|
1158
1158
|
}
|
|
1159
1159
|
calendar[row][col] = theDate.set(time);
|
|
1160
1160
|
|
|
1161
|
-
|
|
1161
|
+
// I have no clue why and how this shall be used in original code. Skip it, maybe I will find out later
|
|
1162
|
+
/*if (this.minDate && calendar[row][col].hasSame(this.minDate, 'month') && calendar[row][col] < this.minDate && side == 'left')
|
|
1162
1163
|
calendar[row][col] = this.minDate;
|
|
1163
1164
|
|
|
1164
1165
|
if (this.maxDate && calendar[row][col].hasSame(this.maxDate, 'month') && calendar[row][col] > this.maxDate && side == 'right')
|
|
1165
1166
|
calendar[row][col] = this.maxDate;
|
|
1167
|
+
*/
|
|
1166
1168
|
}
|
|
1167
1169
|
|
|
1168
1170
|
//make the calendar object available to hoverDate/clickDate
|
|
@@ -1324,7 +1326,7 @@
|
|
|
1324
1326
|
if (!classes.includes('disabled'))
|
|
1325
1327
|
classes.push('available');
|
|
1326
1328
|
|
|
1327
|
-
html += `<td class="${classes.join(' ')}" data-title="r${row}c${col}"
|
|
1329
|
+
html += `<td class="${classes.join(' ')}" data-title="r${row}c${col}">${calendar[row][col].day}</td>`;
|
|
1328
1330
|
|
|
1329
1331
|
}
|
|
1330
1332
|
html += '</tr>';
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "daterangepicker-4.x",
|
|
3
|
-
"version": "4.1.
|
|
4
|
-
"description": "Date range picker component
|
|
3
|
+
"version": "4.1.7",
|
|
4
|
+
"description": "Date range picker with time component and pre-defined ranges",
|
|
5
5
|
"main": "daterangepicker.js",
|
|
6
6
|
"style": "daterangepicker.css",
|
|
7
7
|
"scripts": {
|
|
8
|
+
"postversion": "sed -i -e 's/daterangepicker-4.x@4\\.[0-9]\\+\\.[0-9]\\+/daterangepicker-4.x@%npm_package_version%/' README.md",
|
|
8
9
|
"prepack": "sed -i '/# API Documentation/q' README.md",
|
|
9
10
|
"prepare": "jsdoc2md --EOL win32 --example-lang js daterangepicker.js >> README.md",
|
|
10
11
|
"postpack": "git commit -a -m \"Updated README.md\""
|
|
@@ -20,6 +21,20 @@
|
|
|
20
21
|
"name": "wernfried Domscheit",
|
|
21
22
|
"url": "https://www.domscheit.ch"
|
|
22
23
|
},
|
|
24
|
+
"keywords": [
|
|
25
|
+
"daterangepicker",
|
|
26
|
+
"html",
|
|
27
|
+
"date",
|
|
28
|
+
"time",
|
|
29
|
+
"datepicker",
|
|
30
|
+
"timepicker",
|
|
31
|
+
"rangepicker",
|
|
32
|
+
"calendar"
|
|
33
|
+
],
|
|
34
|
+
"files": [
|
|
35
|
+
"daterangepicker.js",
|
|
36
|
+
"daterangepicker.css"
|
|
37
|
+
],
|
|
23
38
|
"license": "MIT",
|
|
24
39
|
"bugs": {
|
|
25
40
|
"url": "https://github.com/wernfried/daterangepicker/issues"
|
package/bower.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "daterangepicker",
|
|
3
|
-
"main": [
|
|
4
|
-
"daterangepicker.js",
|
|
5
|
-
"daterangepicker.css"
|
|
6
|
-
],
|
|
7
|
-
"ignore": [
|
|
8
|
-
"**/.*",
|
|
9
|
-
"node_modules",
|
|
10
|
-
"bower_components",
|
|
11
|
-
"test",
|
|
12
|
-
"tests",
|
|
13
|
-
"moment.js",
|
|
14
|
-
"moment.min.js"
|
|
15
|
-
],
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"jquery": "1.9.1 - 3",
|
|
18
|
-
"moment": ">=2.9.0"
|
|
19
|
-
}
|
|
20
|
-
}
|
package/demo.html
DELETED
|
@@ -1,411 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html dir="ltr" lang="en-US">
|
|
3
|
-
|
|
4
|
-
<head>
|
|
5
|
-
<meta charset="UTF-8" />
|
|
6
|
-
<title>A date range picker for Bootstrap</title>
|
|
7
|
-
|
|
8
|
-
<link rel="stylesheet" type="text/css" media="all" href="daterangepicker.css" />
|
|
9
|
-
|
|
10
|
-
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js"></script>
|
|
11
|
-
|
|
12
|
-
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/luxon@3.5.0/build/global/luxon.min.js"></script>
|
|
13
|
-
|
|
14
|
-
<script type="text/javascript" src="daterangepicker-luxon.js"></script>
|
|
15
|
-
<link rel="shortcut icon"
|
|
16
|
-
href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='1em' font-size='80'>📅</text></svg>" />
|
|
17
|
-
|
|
18
|
-
<!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries -->
|
|
19
|
-
<!--[if lt IE 9]>
|
|
20
|
-
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
|
|
21
|
-
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
|
|
22
|
-
<![endif]-->
|
|
23
|
-
</head>
|
|
24
|
-
|
|
25
|
-
<body style="margin: 20px 20px">
|
|
26
|
-
|
|
27
|
-
<div class="container">
|
|
28
|
-
|
|
29
|
-
<h1 style="margin: 0 0 20px 0">Configuration Builder</h1>
|
|
30
|
-
|
|
31
|
-
<div class="well configurator">
|
|
32
|
-
|
|
33
|
-
<form>
|
|
34
|
-
<div class="row">
|
|
35
|
-
|
|
36
|
-
<div class="col-md-4">
|
|
37
|
-
|
|
38
|
-
<div class="form-group">
|
|
39
|
-
<label for="parentEl">parentEl</label>
|
|
40
|
-
<input type="text" class="form-control" id="parentEl" value="" placeholder="body">
|
|
41
|
-
</div>
|
|
42
|
-
|
|
43
|
-
<div class="form-group">
|
|
44
|
-
<label for="startDate">startDate</label>
|
|
45
|
-
<input type="text" class="form-control" id="startDate" value="2025-03-04">
|
|
46
|
-
</div>
|
|
47
|
-
|
|
48
|
-
<div class="form-group">
|
|
49
|
-
<label for="endDate">endDate</label>
|
|
50
|
-
<input type="text" class="form-control" id="endDate" value="2025-03-21">
|
|
51
|
-
</div>
|
|
52
|
-
|
|
53
|
-
<div class="form-group">
|
|
54
|
-
<label for="minYear">minYear</label>
|
|
55
|
-
<input type="text" class="form-control" id="minYear" value="2020">
|
|
56
|
-
</div>
|
|
57
|
-
|
|
58
|
-
<div class="form-group">
|
|
59
|
-
<label for="maxYear">maxYear</label>
|
|
60
|
-
<input type="text" class="form-control" id="maxYear" value="2040">
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
<div class="form-group">
|
|
64
|
-
<label for="minDate">minDate</label>
|
|
65
|
-
<input type="text" class="form-control" id="minDate" value="" placeholder="YYYY-MM-DD">
|
|
66
|
-
</div>
|
|
67
|
-
|
|
68
|
-
<div class="form-group">
|
|
69
|
-
<label for="maxDate">maxDate</label>
|
|
70
|
-
<input type="text" class="form-control" id="maxDate" value="" placeholder="YYYY-MM-DD">
|
|
71
|
-
</div>
|
|
72
|
-
|
|
73
|
-
</div>
|
|
74
|
-
<div class="col-md-4">
|
|
75
|
-
|
|
76
|
-
<div class="checkbox">
|
|
77
|
-
<label>
|
|
78
|
-
<input type="checkbox" id="autoApply"> autoApply
|
|
79
|
-
</label>
|
|
80
|
-
</div>
|
|
81
|
-
|
|
82
|
-
<div class="checkbox">
|
|
83
|
-
<label>
|
|
84
|
-
<input type="checkbox" id="singleDatePicker"> singleDatePicker
|
|
85
|
-
</label>
|
|
86
|
-
</div>
|
|
87
|
-
|
|
88
|
-
<div class="checkbox">
|
|
89
|
-
<label>
|
|
90
|
-
<input type="checkbox" id="showDropdowns"> showDropdowns
|
|
91
|
-
</label>
|
|
92
|
-
</div>
|
|
93
|
-
|
|
94
|
-
<div class="checkbox">
|
|
95
|
-
<label>
|
|
96
|
-
<input type="checkbox" id="showWeekNumbers"> showWeekNumbers
|
|
97
|
-
</label>
|
|
98
|
-
</div>
|
|
99
|
-
|
|
100
|
-
<div class="checkbox">
|
|
101
|
-
<label>
|
|
102
|
-
<input type="checkbox" id="showISOWeekNumbers"> showISOWeekNumbers
|
|
103
|
-
</label>
|
|
104
|
-
</div>
|
|
105
|
-
|
|
106
|
-
<div class="checkbox">
|
|
107
|
-
<label>
|
|
108
|
-
<input type="checkbox" id="timePicker" checked="checked"> timePicker
|
|
109
|
-
</label>
|
|
110
|
-
</div>
|
|
111
|
-
|
|
112
|
-
<div class="checkbox">
|
|
113
|
-
<label>
|
|
114
|
-
<input type="checkbox" id="timePicker24Hour"> timePicker24Hour
|
|
115
|
-
</label>
|
|
116
|
-
</div>
|
|
117
|
-
|
|
118
|
-
<div class="form-group">
|
|
119
|
-
<label for="timePickerStepSize">timePickerStepSize (in seconds)</label>
|
|
120
|
-
<input type="text" class="form-control" id="timePickerStepSize" value="600">
|
|
121
|
-
</div>
|
|
122
|
-
|
|
123
|
-
<div class="checkbox">
|
|
124
|
-
<label>
|
|
125
|
-
<input type="checkbox" id="minSpan"> minSpan (with example date span)
|
|
126
|
-
</label>
|
|
127
|
-
</div>
|
|
128
|
-
|
|
129
|
-
<div class="checkbox">
|
|
130
|
-
<label>
|
|
131
|
-
<input type="checkbox" id="maxSpan"> maxSpan (with example date span)
|
|
132
|
-
</label>
|
|
133
|
-
</div>
|
|
134
|
-
|
|
135
|
-
<div class="checkbox">
|
|
136
|
-
<label>
|
|
137
|
-
<input type="checkbox" id="ranges" checked="checked"> ranges (with example predefined ranges)
|
|
138
|
-
</label>
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
<div class="checkbox">
|
|
142
|
-
<label>
|
|
143
|
-
<input type="checkbox" id="locale"> locale (with example settings)
|
|
144
|
-
</label>
|
|
145
|
-
<label id="rtl-wrap">
|
|
146
|
-
<input type="checkbox" id="rtl"> RTL (right-to-left)
|
|
147
|
-
</label>
|
|
148
|
-
</div>
|
|
149
|
-
|
|
150
|
-
<div class="checkbox">
|
|
151
|
-
<label>
|
|
152
|
-
<input type="checkbox" id="alwaysShowCalendars"> alwaysShowCalendars
|
|
153
|
-
</label>
|
|
154
|
-
</div>
|
|
155
|
-
|
|
156
|
-
</div>
|
|
157
|
-
<div class="col-md-4">
|
|
158
|
-
|
|
159
|
-
<div class="checkbox">
|
|
160
|
-
<label>
|
|
161
|
-
<input type="checkbox" id="linkedCalendars" checked="checked"> linkedCalendars
|
|
162
|
-
</label>
|
|
163
|
-
</div>
|
|
164
|
-
|
|
165
|
-
<div class="checkbox">
|
|
166
|
-
<label>
|
|
167
|
-
<input type="checkbox" id="autoUpdateInput" checked="checked"> autoUpdateInput
|
|
168
|
-
</label>
|
|
169
|
-
</div>
|
|
170
|
-
|
|
171
|
-
<div class="checkbox">
|
|
172
|
-
<label>
|
|
173
|
-
<input type="checkbox" id="showCustomRangeLabel" checked="checked"> showCustomRangeLabel
|
|
174
|
-
</label>
|
|
175
|
-
</div>
|
|
176
|
-
|
|
177
|
-
<div class="checkbox">
|
|
178
|
-
<label>
|
|
179
|
-
<input type="checkbox" id="durationLabel" checked="checked"> durationLabel (with example format)
|
|
180
|
-
</label>
|
|
181
|
-
</div>
|
|
182
|
-
|
|
183
|
-
<div class="form-group">
|
|
184
|
-
<label for="opens">opens</label>
|
|
185
|
-
<select id="opens" class="form-control">
|
|
186
|
-
<option value="right" selected>right</option>
|
|
187
|
-
<option value="left">left</option>
|
|
188
|
-
<option value="center">center</option>
|
|
189
|
-
</select>
|
|
190
|
-
</div>
|
|
191
|
-
|
|
192
|
-
<div class="form-group">
|
|
193
|
-
<label for="drops">drops</label>
|
|
194
|
-
<select id="drops" class="form-control">
|
|
195
|
-
<option value="down" selected>down</option>
|
|
196
|
-
<option value="up">up</option>
|
|
197
|
-
</select>
|
|
198
|
-
</div>
|
|
199
|
-
|
|
200
|
-
<div class="form-group">
|
|
201
|
-
<label for="buttonClasses">buttonClasses</label>
|
|
202
|
-
<input type="text" class="form-control" id="buttonClasses" value="btn btn-sm">
|
|
203
|
-
</div>
|
|
204
|
-
|
|
205
|
-
<div class="form-group">
|
|
206
|
-
<label for="applyClass">applyClass</label>
|
|
207
|
-
<input type="text" class="form-control" id="applyClass" value="btn-success">
|
|
208
|
-
</div>
|
|
209
|
-
|
|
210
|
-
<div class="form-group">
|
|
211
|
-
<label for="cancelClass">cancelClass</label>
|
|
212
|
-
<input type="text" class="form-control" id="cancelClass" value="btn-default">
|
|
213
|
-
</div>
|
|
214
|
-
|
|
215
|
-
</div>
|
|
216
|
-
|
|
217
|
-
</div>
|
|
218
|
-
</form>
|
|
219
|
-
|
|
220
|
-
</div>
|
|
221
|
-
|
|
222
|
-
<div class="row">
|
|
223
|
-
|
|
224
|
-
<div class="col-md-4 col-md-offset-2 demo">
|
|
225
|
-
<h4>Your Date Range Picker</h4>
|
|
226
|
-
<center>
|
|
227
|
-
<input type="text" id="config-demo" class="form-control">
|
|
228
|
-
</center>
|
|
229
|
-
</div>
|
|
230
|
-
|
|
231
|
-
<div class="col-md-6">
|
|
232
|
-
<h4>Configuration</h4>
|
|
233
|
-
|
|
234
|
-
<div class="well">
|
|
235
|
-
<textarea id="config-text" style="height: 300px; width: 100%; padding: 10px"></textarea>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
|
|
239
|
-
</div>
|
|
240
|
-
|
|
241
|
-
</div>
|
|
242
|
-
|
|
243
|
-
<style type="text/css">
|
|
244
|
-
.demo {
|
|
245
|
-
position: relative;
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
.demo i {
|
|
249
|
-
position: absolute;
|
|
250
|
-
bottom: 10px;
|
|
251
|
-
right: 24px;
|
|
252
|
-
top: auto;
|
|
253
|
-
cursor: pointer;
|
|
254
|
-
}
|
|
255
|
-
</style>
|
|
256
|
-
|
|
257
|
-
<script type="text/javascript">
|
|
258
|
-
$(document).ready(function () {
|
|
259
|
-
const DateTime = luxon.DateTime;
|
|
260
|
-
const Duration = luxon.Duration;
|
|
261
|
-
|
|
262
|
-
$('#config-text').keyup(function () {
|
|
263
|
-
eval($(this).val());
|
|
264
|
-
});
|
|
265
|
-
|
|
266
|
-
$('.configurator input, .configurator select').change(function () {
|
|
267
|
-
updateConfig();
|
|
268
|
-
});
|
|
269
|
-
|
|
270
|
-
$('.demo i').click(function () {
|
|
271
|
-
$(this).parent().find('input').click();
|
|
272
|
-
});
|
|
273
|
-
|
|
274
|
-
$('#startDate').daterangepicker({
|
|
275
|
-
singleDatePicker: true,
|
|
276
|
-
startDate: DateTime.now().startOf('hour').minus({ days: 6 }).toISO()
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
$('#endDate').daterangepicker({
|
|
280
|
-
singleDatePicker: true,
|
|
281
|
-
endDate: DateTime.now().startOf('hour').toISO()
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
updateConfig();
|
|
285
|
-
|
|
286
|
-
function updateConfig() {
|
|
287
|
-
var options = {};
|
|
288
|
-
|
|
289
|
-
if ($('#singleDatePicker').is(':checked'))
|
|
290
|
-
options.singleDatePicker = true;
|
|
291
|
-
|
|
292
|
-
if ($('#showDropdowns').is(':checked'))
|
|
293
|
-
options.showDropdowns = true;
|
|
294
|
-
|
|
295
|
-
if ($('#showWeekNumbers').is(':checked'))
|
|
296
|
-
options.showWeekNumbers = true;
|
|
297
|
-
|
|
298
|
-
if ($('#showISOWeekNumbers').is(':checked'))
|
|
299
|
-
options.showISOWeekNumbers = true;
|
|
300
|
-
|
|
301
|
-
if ($('#timePicker').is(':checked'))
|
|
302
|
-
options.timePicker = true;
|
|
303
|
-
|
|
304
|
-
if ($('#timePicker24Hour').is(':checked'))
|
|
305
|
-
options.timePicker24Hour = true;
|
|
306
|
-
|
|
307
|
-
if ($('#minYear').val().length && $('#minYear').val() != 2020)
|
|
308
|
-
options.minYear = $('#minYear').val(), 10;
|
|
309
|
-
|
|
310
|
-
if ($('#maxYear ').val().length && $('#maxYear ').val() != 2040)
|
|
311
|
-
options.maxYear = $('#maxYear ').val(), 10;
|
|
312
|
-
|
|
313
|
-
if ($('#timePickerStepSize').val().length && $('#timePickerStepSize').val() != 600)
|
|
314
|
-
options.timePickerStepSize = $('#timePickerStepSize').val(), 10;
|
|
315
|
-
|
|
316
|
-
if ($('#autoApply').is(':checked'))
|
|
317
|
-
options.autoApply = true;
|
|
318
|
-
|
|
319
|
-
if ($('#minDate').val().length)
|
|
320
|
-
options.minDate = DateTime.now().minus({ month: 3 });
|
|
321
|
-
|
|
322
|
-
if ($('#maxDate').val().length)
|
|
323
|
-
options.maxDate = DateTime.now().minus({ years: 3 });
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
if ($('#ranges').is(':checked')) {
|
|
327
|
-
options.ranges = {
|
|
328
|
-
'Today': [DateTime.now().startOf('day'), DateTime.now().endOf('day')],
|
|
329
|
-
'Yesterday': [DateTime.now().startOf('day').minus({ days: 1 }), DateTime.now().minus({ days: 1 }).endOf('day')],
|
|
330
|
-
'Last 7 Days': [DateTime.now().startOf('day').minus({ days: 6 }), DateTime.now().endOf('day')],
|
|
331
|
-
'Last 30 Days': [DateTime.now().startOf('day').minus(29, 'days'), DateTime.now().endOf('day')],
|
|
332
|
-
'This Month': [DateTime.now().startOf('day').startOf('month'), DateTime.now().endOf('month')],
|
|
333
|
-
'Last Month': [DateTime.now().startOf('day').minus({ month: 1 }).startOf('month'), DateTime.now().minus({ month: 1 }).endOf('month')]
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
if ($('#locale').is(':checked')) {
|
|
338
|
-
$('#rtl-wrap').show();
|
|
339
|
-
options.locale = {
|
|
340
|
-
direction: $('#rtl').is(':checked') ? 'rtl' : 'ltr',
|
|
341
|
-
format: 'yyyy-MM-dd HH:mm',
|
|
342
|
-
separator: ' - ',
|
|
343
|
-
applyLabel: 'Apply',
|
|
344
|
-
cancelLabel: 'Cancel',
|
|
345
|
-
fromLabel: 'From',
|
|
346
|
-
toLabel: 'To',
|
|
347
|
-
customRangeLabel: 'Custom',
|
|
348
|
-
daysOfWeek: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
|
|
349
|
-
monthNames: ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'],
|
|
350
|
-
firstDay: 1
|
|
351
|
-
};
|
|
352
|
-
} else {
|
|
353
|
-
$('#rtl-wrap').hide();
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
if (!$('#linkedCalendars').is(':checked'))
|
|
357
|
-
options.linkedCalendars = false;
|
|
358
|
-
|
|
359
|
-
if (!$('#autoUpdateInput').is(':checked'))
|
|
360
|
-
options.autoUpdateInput = false;
|
|
361
|
-
|
|
362
|
-
if (!$('#showCustomRangeLabel').is(':checked'))
|
|
363
|
-
options.showCustomRangeLabel = false;
|
|
364
|
-
|
|
365
|
-
if ($('#alwaysShowCalendars').is(':checked'))
|
|
366
|
-
options.alwaysShowCalendars = true;
|
|
367
|
-
|
|
368
|
-
if ($('#parentEl').val().length)
|
|
369
|
-
options.parentEl = $('#parentEl').val();
|
|
370
|
-
|
|
371
|
-
if ($('#startDate').val().length)
|
|
372
|
-
options.startDate = $('#startDate').val();
|
|
373
|
-
|
|
374
|
-
if ($('#endDate').val().length)
|
|
375
|
-
options.endDate = $('#endDate').val();
|
|
376
|
-
|
|
377
|
-
if ($('#minDate').val().length)
|
|
378
|
-
options.minDate = $('#minDate').val();
|
|
379
|
-
|
|
380
|
-
if ($('#maxDate').val().length)
|
|
381
|
-
options.maxDate = $('#maxDate').val();
|
|
382
|
-
|
|
383
|
-
if ($('#opens').val().length && $('#opens').val() != 'right')
|
|
384
|
-
options.opens = $('#opens').val();
|
|
385
|
-
|
|
386
|
-
if ($('#drops').val().length && $('#drops').val() != 'down')
|
|
387
|
-
options.drops = $('#drops').val();
|
|
388
|
-
|
|
389
|
-
if ($('#buttonClasses').val().length && $('#buttonClasses').val() != 'btn btn-sm')
|
|
390
|
-
options.buttonClasses = $('#buttonClasses').val();
|
|
391
|
-
|
|
392
|
-
if ($('#applyClass').val().length && $('#applyClass').val() != 'btn-success')
|
|
393
|
-
options.applyClass = $('#applyClass').val();
|
|
394
|
-
|
|
395
|
-
if ($('#cancelClass').val().length && $('#cancelClass').val() != 'btn-default')
|
|
396
|
-
options.cancelClass = $('#cancelClass').val();
|
|
397
|
-
|
|
398
|
-
$('#config-text').val("$('#demo').daterangepicker(" + JSON.stringify(options, null, ' ') + ", function(start, end, label) {\n console.log(\"New date range selected: ' + start.format('YYYY-MM-DD') + ' to ' + end.format('YYYY-MM-DD') + ' (predefined range: ' + label + ')\");\n});");
|
|
399
|
-
|
|
400
|
-
$('#config-demo').daterangepicker(options, function (start, end, label) {
|
|
401
|
-
console.log('New date range selected: ' + start.toFormat('yyyy-MM-dd') + ' to ' + end.format('yyyy-MM-dd') + ' (predefined range: ' + label + ')');
|
|
402
|
-
}).click();;
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
|
|
406
|
-
});
|
|
407
|
-
</script>
|
|
408
|
-
|
|
409
|
-
</body>
|
|
410
|
-
|
|
411
|
-
</html>
|
package/drp.png
DELETED
|
Binary file
|