function localData(value) {
let date = new Date(value );
let Month = date.getMonth() + 1;
let Day = date.getDate();
let Y = date.getFullYear() + '-';
let M = Month < 10 ? '0' + Month + '-' : Month + '-';
let D = Day + 1 < 10 ? '0' + Day : Day;
return Y + M + D;
}
console.log(localData('123456787'))