JSFiddle - React, Tailwind, and code Playground
by Jan Föh
JavaScript
function newTimePeriod(ID, param, paramID, unit)
{
updateSession();
//check if date
//(I got this regex from another post)
var re = new RegExp("^\\d{4,4}(-\\d{1,2}){1,2}( \\d{1,2}(:\\d{1,2}){1,2})?$");
var dateFrom = document.getElementById("chart_date_min_" + ID).value;
var dateTo = document.getElementById("chart_date_max_" + ID).value;
var fromCorrect = re.test(dateFrom);
var toCorrect = re.test(dateFrom);
if (fromCorrect && toCorrect){
LoadGraph(ID, param, paramID, unit, dateFrom, dateTo);
}
}