Problem to save and update in custom form

Hi, i have the next problem when i want to save events. I have my custom form. I cant use dates correctly, this is my code.

save_form = function() {
ev = scheduler.getEvent(scheduler.getState().lightbox_id);
ev.text = html("description").value;
ev.details = html("details").value;
//formato fecha inicio
//ev.start_date=html("inicio").value;
inicio = html("inicio").value;
var hinicio = html("hinicio").value;
var hr = parseInt(hinicio/60);
hr = (hr<10)?"0" + hr : hr;
var min = hinicio % 60;
min = (min<10)?"0" + min : min;
var hora = hr + ":" + min;
var elem = inicio.split("-");
dia = elem[0];
mes = elem[1];
año = elem[2];
scheduler.getEvent(idev).start_date=año+"-"+mes+"-"+dia+" "+hora;
//formato fecha fin
var fin = html("fin").value;
var hfin = html("hfin").value;
var fhr = parseInt(hfin/60);
fhr = (fhr<10)?"0" + fhr : fhr;
var fmin = hfin % 60;
fmin = (fmin<10)?"0" + fmin : fmin;
var fhora = fhr + ":" + fmin;
var felem = fin.split("-");
fdia = felem[0];
fmes = felem[1];
faño = felem[2];
scheduler.getEvent(idev).end_date = faño+"-"+fmes+"-"+fdia+" "+fhora;
//ev.end_date = end_date;
//var text=html("description").value;
//addEvent(start_date, end_date, text);
if(id != 1358349865118){
}
scheduler.endLightbox(true, html("my_form"));
//addEvent(start_date, end_date, text);
} 

Thanks

start and end date must be date objects not date strings

scheduler.getEvent(idev).start_date = new Date(año,mes-1,dia,hora);

OH thanks so much. It works :smiley: