Skip to content

Commit 5610515

Browse files
committed
Add new usage showcase for month & date select + startDate & endDate config
1 parent 9249fe7 commit 5610515

File tree

2 files changed

+38
-19
lines changed

2 files changed

+38
-19
lines changed

demo.js

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ $(function()
1818
define a new language named "custom"
1919
*/
2020

21-
$.dateRangePickerLanguages['custom'] =
21+
$.dateRangePickerLanguages['custom'] =
2222
{
2323
'selected': 'Choosed:',
2424
'days': 'Days',
@@ -48,7 +48,7 @@ $(function()
4848
'default-range' : 'Please select a date range between %d and %d days',
4949
'default-default': 'This is costom language'
5050
};
51-
51+
5252
$('#date-range0').dateRangePicker(
5353
{
5454
}).on('datepicker-first-date-selected', function(event, obj)
@@ -156,7 +156,7 @@ $(function()
156156
startOfWeek: 'sunday',
157157
language:'en',
158158
showShortcuts: true,
159-
customShortcuts:
159+
customShortcuts:
160160
[
161161
//if return an array of two dates, it will select the date range between the two dates
162162
{
@@ -188,8 +188,8 @@ $(function()
188188

189189
$('#date-range101').dateRangePicker(
190190
{
191-
showShortcuts: true,
192-
shortcuts :
191+
showShortcuts: true,
192+
shortcuts :
193193
{
194194
'next-days': [3,5,7],
195195
'next': ['week','month','year']
@@ -199,7 +199,7 @@ $(function()
199199
$('#date-range102').dateRangePicker(
200200
{
201201
showShortcuts: true,
202-
shortcuts :
202+
shortcuts :
203203
{
204204
'prev-days': [3,5,7],
205205
'prev': ['week','month','year'],
@@ -277,17 +277,17 @@ $(function()
277277
$('#date-range12').dateRangePicker(
278278
{
279279
inline:true,
280-
container: '#date-range12-container',
281-
alwaysOpen:true
280+
container: '#date-range12-container',
281+
alwaysOpen:true
282282
});
283283

284284
$('#date-range13').dateRangePicker(
285285
{
286286
autoClose: true,
287287
singleDate : true,
288-
showShortcuts: false
288+
showShortcuts: false
289289
});
290-
290+
291291
$('#date-range13-2').dateRangePicker(
292292
{
293293
autoClose: true,
@@ -483,7 +483,7 @@ $(function()
483483
});
484484

485485
$('#date-range51').dateRangePicker(
486-
{
486+
{
487487
customArrowPrevSymbol: '<i class="fa fa-arrow-circle-left"></i>',
488488
customArrowNextSymbol: '<i class="fa fa-arrow-circle-right"></i>'
489489
});
@@ -500,13 +500,19 @@ $(function()
500500
yearSelect: [1900, moment().get('year')]
501501
});
502502

503-
$('#date-range54').dateRangePicker(
503+
$('#date-range54').dateRangePicker(
504+
{
505+
monthSelect: true,
506+
yearSelect: function(current) {
507+
return [current - 10, current + 10];
508+
}
509+
});
510+
511+
$('#date-range55').dateRangePicker(
504512
{
505513
monthSelect: true,
506-
yearSelect: function(current) {
507-
return [current - 10, current + 10];
508-
}
514+
yearSelect: true,
515+
startDate: moment().subtract(3, 'months').format('YYYY-MM-DD'),
516+
endDate: moment().endOf('day').format('YYYY-MM-DD'),
509517
});
510-
511-
512518
});

index.html

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,8 @@ <h2 id="demonstrations">Demonstrations</h2>
673673
Custom arrow symbol: <input id="date-range51" size="30" value="">
674674
<a href="#" class="show-option">Show Config</a>
675675
<pre class="options">
676-
// To make this demo work completely, the FontAwesome stylesheets are required
677-
{
676+
// To make this demo work completely, the FontAwesome stylesheets are required
677+
{
678678
customArrowPrevSymbol: '&lt;i class="fa fa-arrow-circle-left"&gt;&lt;/i&gt;',
679679
customArrowNextSymbol: '&lt;i class="fa fa-arrow-circle-right"&gt;&lt;/i&gt;'
680680
}
@@ -712,6 +712,19 @@ <h2 id="demonstrations">Demonstrations</h2>
712712
yearSelect: function(current) {
713713
return [current - 10, current + 10];
714714
}
715+
}
716+
</pre>
717+
</li>
718+
719+
<li class="demo">
720+
Month and year select min and max dates: <input id="date-range55" size="30" value="">
721+
<a href="#" class="show-option">Show Config</a>
722+
<pre class="options">
723+
{
724+
monthSelect: true,
725+
yearSelect: true,
726+
startDate: moment().subtract(3, 'months').format('YYYY-MM-DD'),
727+
endDate: moment().endOf('day').format('YYYY-MM-DD'),
715728
}
716729
</pre>
717730
</li>

0 commit comments

Comments
 (0)