How to use date_date_callbacks In Datetime.php from Core\Datetime\Element, I read:

#date_date_callbacks: Array of optional callbacks for the date element.
    Can be used to add a jQuery datepicker.


What does it mean? How am I supposed to add a jQuery datepicker from a PHP function? Right now I am doing from a JS file included as a library, but I'd like to keep my custom widget more self contained (I am developing a custom widget to select weeks using jQuery datepicker).
The first argument those callbacks get is $element which, essentially, is a render array as described in Render API overview. This means, for example, that a #date_date_callbacks callback could use code similar to the following one.

function mymodule_date_callback($element, $form_state, $date) {
  $element['date']['#attached']['library'][] = 'mymodule/mylibrary';
  // Optionally, the callback can pass values to the JavaScript code.
  $element['date']['#attached']['drupalSettings']['foo'] = 'bar';
}