const newStr = new Date(str.split(' GMT', 1)[0])
.toLocaleDateString('ru-RU')
.split('.')
.reverse()
.join(', ');
const formatDateStr = function(str) {
const [ , month, day, year ] = str.match(/(\S+) (\d+) (\d+)/);
return [ year, this[month], day.padStart(2, 0) ].join(', ');
}.bind(Object.fromEntries(Array.from({ length: 12 }, (_, i) => [
new Date(0, i).toLocaleString('en', { month: 'short' }),
`${i + 1}`.padStart(2, 0)
])));
const newStr = formatDateStr(str);
function MyDate(date){
this.date = new Date(date);
const options = {
year: 'numeric',
month: 'numeric',
day: '2-digit'
}
const locale = 'en'
const f = new Intl.DateTimeFormat(locale, options);
const [{ value: mo },,{ value: da },,{ value: ye }] = f.formatToParts(this.date);
this.formatData = () => console.log(`${ye},${mo},${da}`);
}
let d = new MyDate('Tue Apr 27 2021 00:33:00 GMT+0500 (Екатеринбург, стандартное время)');
d.formatData();