JSFiddle - React, Tailwind, and code Playground

by Dmitri Ganenco

JavaScript

const arr = [{
"year": 2019,
"month": 6,
"day": 25,
"hour": 4,
"minute": 0,
"temperature": 26.52
},
{
"year": 2019,
"month": 6,
"day": 25,
"hour": 4,
"minute": 0,
"temperature": 26.52
}];

const newArr = arr.reduce((a,c) => {
	const date = new Date(c.year, c.month - 1, c.day, c.hour, c.minute);
	a.push({date, temperature: c.temperature});
	return a;
}, []);

console.log(JSON.stringify(newArr));