I am trying to seed one field from another onChange, almost there but throwing an error when I try and access 'endDate' from within onSet, obviously I don't have access to it from within the function?:
var endDate = $('.end-date .datepicker').pickadate({
formatSubmit: 'yyyy-mm-dd'
})
// Would like date from here copied over to endDate on change
var startDate = $('.start-date .datepicker').pickadate({
formatSubmit: 'yyyy-mm-dd',
onSet: function(endDate) {
console.log('Want to set endDate to - ' + this.get('select', 'yyyy/mm/dd'));
endDate.set('select', this.get('select')); // This line is wrong ..
}
})