Time loop

by jwerre

JavaScript

const maxDate = new Date();
const minDate = new Date();

minDate.setHours(minDate.getHours()-24);

console.log(maxDate, minDate);


for (let ms = minDate.getTime(); ms < maxDate.getTime(); ms+=1000) {

	const d = new Date(ms);
	const year = d.getFullYear();
	const month = d.getMonth();
	const day = d.getDate();
	const formated = `${year}-${month}-${day}`;
	console.log(formated);
	
	//const res = stringToDate(formated);
	
	
	//expect(d.toISOString()).toBe(res);


}