Hi David,
Here goes the code that matters:
<cut>
// Calendarios
$data->setDate(date('Y'),date('m'), date('d'));
$data->setTime( 23, 59, 59); //zero hora
//echo $data->format('d/m/Y H:i:s'); exit;
$dtFiltIni = new KoolDateTimePicker("dtFiltIni"); //Create calendar object
$dtFiltIni->scriptFolder = $KoolControlsFolder."/KoolCalendar";//Set scriptFolder
$dtFiltIni->Localization->Load($KoolControlsFolder."/KoolCalendar/localization/pt_br.xml");
$dtFiltIni->styleFolder="default";
$dtFiltIni->DateFormat = "d/m/Y";
$dtFiltIni->TimeFormat = "H:i:s";
$dtFiltIni->TimeViewSettings->TimeFormat = "H:i:s";
$dtFiltIni->TimeViewSettings->Interval = mktime(0,15,0); // Every 15 minutes
$dtFiltIni->TimeViewSettings->HeaderText = "Hora Início";
$dtFiltIni->Width = "170px";
$dtFiltIni->CalendarSettings->ShowRowHeader=false;
$dtFiltIni->CalendarSettings->ShowDayCellToolTips = false;
$dtFiltIni->CalendarSettings->ShowToday = true;
$dtFiltFim = new KoolDateTimePicker("dtFiltFim"); //Create calendar object
$dtFiltFim->scriptFolder = $KoolControlsFolder."/KoolCalendar";//Set scriptFolder
$dtFiltFim->Localization->Load($KoolControlsFolder."/KoolCalendar/localization/pt_br.xml");
$dtFiltFim->styleFolder="default";
$dtFiltFim->DateFormat = "d/m/Y";
$dtFiltFim->TimeFormat = "H:i:s";
$dtFiltFim->TimeViewSettings->TimeFormat = "H:i:s";
$dtFiltFim->TimeViewSettings->Interval = mktime(0,15,0); // Every 15 minutes
$dtFiltFim->TimeViewSettings->HeaderText = "Hora Término";
//$dtFiltFim->TimeViewSettings->
$dtFiltFim->Width = "170px";
$dtFiltFim->CalendarSettings->ShowRowHeader=false;
$dtFiltFim->CalendarSettings->ShowDayCellToolTips = false;
$dtFiltFim->CalendarSettings->ShowToday = true;
$dtFiltFim->Value = $data->format('d/m/Y H:i:s'); // <= this is working fine
$data->sub(date_interval_create_from_date_string(($data->format('d')-1).' days'));
$data->setTime(0,0,0);
$dtFiltIni->Value = $data->format('d/m/Y H:i:s'); // <= this is working fine
$dtFiltIni->Init();
$dtFiltFim->Init();
<cut>
// Here is the problem
function pageLoad(){
var blk = null;
var sData;
var theForm;
//var dataIni = null;
justNow = new Date();
dataIni = new Date(justNow.getFullYear(),justNow.getMonth(), justNow.getDate() - 2,0,0,0,0);
if( dtFiltIni && dtFiltFim ){
theForm = document.getElementById("filtevt");
theForm.dtFiltIni.value = dataIni.toLocaleString() ;
theForm.dtFiltFim.value = justNow.toLocaleString();
}
else alert("Not objects");
<cut>
<!-- render the controls -->
<form id="filtevt" action="" style="margin: 0px 0px 0px 10px; height:100%; width: 150px; font-size:10pt;">
<label for="dtFiltIni" style="margin: 2px 0px 0px 0px; float: left; ">De : </label><div style="display: inline-block; margin: 0px 15px 0px 0px; width: 180px; height: 25px; border: none; float: right;"><?php echo $dtFiltIni->Render(); ?></div><br>
<label for="dtFiltFim" style="margin: 14px 0px 0px 0px; clear: both; float: left; ">Até: </label><div style="display: inline-block; margin:10px 15px 0px 0px; width: 180px; height: 25px; border: none; float: right;"><?php echo $dtFiltFim->Render(); ?></div><br>
</form>
I hope you can find the problem.
While I have not other solution I am setting the Date and Time value of the control in the PHP code, but I need to refresh the date and time of dtFiltFim periodically to have it updated to the current date and time every time some event is fired.
Thanks!
Best regards.