datepicker options do not work

My very first experiments with elgg. elgg_view('input/date' uses the datepicker function, but I need to add some options.

In my plugin (called "help") initialization function I declared
    elgg_extend_view('js/elgg', 'help/js');
Then, in \mod\help\views\default\help\js.php I copied the elgg.ui.initDatePicker function adding my options and adding

elgg.provide('elgg.help');

on the top and

elgg.register_hook_handler('init', 'system', elgg.ui.initDatePicker);

on the bottom.

======== Begin code =====

<?php
/**
 * Initialize the date picker
 *
 * Uses the class .elgg-input-date as the selector.
 *
 * If the class .elgg-input-timestamp is set on the input element, the onSelect
 * method converts the date text to a unix timestamp in seconds. That value is
 * stored in a hidden element indicated by the id on the input field.
 *
 * @return void
 */

?>

elgg.provide('elgg.help');

elgg.ui.initDatePicker = function() {
    var loadDatePicker = function() {
        $('.elgg-input-date').datepicker({
            
            // MY OPTIONS ADDED
            yearRange: "-100:+0",
            changeYear: true,
            changeMonth: true,

            // ISO-8601
            dateFormat: 'yy-mm-dd',
            onSelect: function(dateText) {
                if ($(this).is('.elgg-input-timestamp')) {
                    // convert to unix timestamp
                    var dateParts = dateText.split("-");
                    var timestamp = Date.UTC(dateParts[0], dateParts[1] - 1, dateParts[2]);
                    timestamp = timestamp / 1000;

                    var id = $(this).attr('id');
                    $('input[name="' + id + '"]').val(timestamp);
                }
            }
        });
    };
    
    if ($('.elgg-input-date').length && elgg.get_language() == 'en') {
        loadDatePicker();
    } else if ($('.elgg-input-date').length) {
        elgg.get({
            url: elgg.config.wwwroot + 'vendors/jquery/i18n/jquery.ui.datepicker-'+ elgg.get_language() +'.js',
            dataType: "script",
            cache: true,
            success: loadDatePicker,
            error: loadDatePicker // english language is already loaded.
        });
    }
}

elgg.register_hook_handler('init', 'system', elgg.ui.initDatePicker);

======== End code =====

It does indeed open a calendar, but it does not apply my yearRange,changeYear and changeMonth options. Though, if I just add the options in elgg\js\lib\ui.js it works fine. Since I don't want to mess with the core file I ask for hints here. Thank you.

Beginning Developers

Beginning Developers

This space is for newcomers, who wish to build a new plugin or to customize an existing one to their liking