diff options
Diffstat (limited to 'views/default/js')
-rw-r--r-- | views/default/js/event_calendar/event_calendar.php | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/views/default/js/event_calendar/event_calendar.php b/views/default/js/event_calendar/event_calendar.php index 360f39f6c..f9e3d63c2 100644 --- a/views/default/js/event_calendar/event_calendar.php +++ b/views/default/js/event_calendar/event_calendar.php @@ -21,6 +21,11 @@ elgg.event_calendar.init = function () { $('#event-calendar-end-time-wrapper').attr('disabled','disabled'); } all_day_field.change(elgg.event_calendar.handleAllDayField); + + $('.elgg-input-date[name="start_date"], .elgg-input-date[name="end_date"]').datepicker({ + numberOfMonths: 3, + onSelect: elgg.event_calendar.handleDateRangeSelect, + }); } elgg.event_calendar.handleScheduleType = function(e) { @@ -61,6 +66,14 @@ elgg.event_calendar.handleAllDayField = function(e) { } } +elgg.event_calendar.handleDateRangeSelect = function(selectedDate) { + if (this.name == 'start_date') { + $('.elgg-input-date[name="end_date"]').datepicker("option", "minDate", selectedDate); + } else { + $('.elgg-input-date[name="start_date"]').datepicker("option", "maxDate", selectedDate); + } +} + elgg.event_calendar.handleEditFormSubmit = function(e) { if ($.trim($('[name="title"]').val()) == '') { alert(elgg.echo('event_calendar:edit_form:error:missing_title')); |