// ROUTING FUNCTIONS

// Convert date from DD MON YYYY to YYYYMMDD
function getDate() {
	const dict = {
		'Jan': '01',
		'Feb': '02',
		'Mar': '03', 
		'Apr': '04', 
		'May': '05', 
		'Jun': '06',
		'Jul': '07', 
		'Aug': '08', 
		'Sep': '09', 
		'Oct': '10', 
		'Nov': '11', 
		'Dec': '12'
	};
 	date = document.getElementById('date').value;
	splitDate = date.split(' ');
	month = dict[splitDate[1]];
	return '&date=' + splitDate[2] + month + splitDate[0];
}

// Send the URL to the CMS
function sendURL(url) {
    window.history.pushState("URL from Dashboard", "", url);
    parent.postMessage(url, '*');
}