Using datepicker's onClose or onSelect method to populate an alternative field with a different date format

Using datepicker's onClose or onSelect method to populate an alternative field with a different date format

I have a page used for scheduling that requires multiple date fields.
The owner wants the dates to be displayed in the M-dd format.
The database needs the date to be in the yy-mm-dd format.

I have a hidden field to receive the database formatted date, but I'm not getting how to make datepicker populate the hidden altField that ties to the displayed date field.

My confusion lies in that I haven't been able to figure out how to pull an attribute value from the displayed date field, and use that value to address the hidden database date field.

Any help would be greatly appreciated.

Here is what one of the scheduling fields look like (the "-5" indicating that it is the 5th of several date inputs on the page):
  1. <input type="text" size="9" class="pickDate" 
  2.    data-target-id="estimate-scheduled-5" id="pickDate-5"
  3.    value="Jan-01" />
  4. <input type="hidden" class="change" id="estimate-scheduled-5"
  5.    value="0000-00-00" />

And the relevant JS:
  1. $('.pickDate').datepicker({
  2.   dateFormat: 'M-dd',
  3.   altFormat: "yy-mm-dd",
  4.   onSelect: function(id = $(this).attr("data-target-id")){
  5.     $("#" + id).val([ the database formatted date])
  6.   }
  7. });