Get time matching ui_date_picker

Try this...

Essentially, this function can deduct the time offset based on timezone to ensure correct date...

msg.payload = convertUTCDateToLocalDate(msg.payload);

return msg;

function convertUTCDateToLocalDate(date) {
    date = new Date(date);
    var newDate = new Date(date.getTime() + date.getTimezoneOffset() * 60 * 1000);
    var offset = date.getTimezoneOffset() / 60;
    var hours = date.getHours();
    newDate.setHours(hours - offset);
    return newDate;
}