Hi, i am trying to make a confirmation box when moving an appointment.
The problem here is that the:
args.get_targetSlot().get_startTime().format(
"HH:mm"
);
returns wrong time, wye is that?
function onAppointmentMoveEnd(sender, args) {
var appointment = args.get_appointment();
var scheduler = $find(
"<%= RadScheduler1.ClientID %>"
);
var fromTime = appointment.get_start();
var customerName = appointment.get_resources().getResourceByType(
"Kunder"
).get_text();
var fromRoom = appointment.get_resources().getResourceByType(
"Rum"
).get_text();
var targetRoom = args.get_targetSlot().get_resource().get_text();
var targetTime = args.get_targetSlot().get_startTime().format(
"HH:mm"
);
// Calculate the duration of the appointment
var appointmentDuration = appointment.get_end() - appointment.get_start();
var newFromEndTime =
new
Date(fromTime.getTime() + appointmentDuration);
var editSeries = args.get_editingRecurringSeries();
// Pop a confirmation window
var confirmMessage =
"Är du säker på att du vill flytta "
+ customerName +
"?<p> <strong> Från:</strong> "
+ fromRoom +
" <strong>kl:</strong> "
+ fromTime.format(
"HH:mm"
) +
"<br/> <strong>Till:</strong> "
+ targetRoom +
" <strong>kl:</strong> "
+ targetTime +
"</p>"
;
radconfirm(confirmMessage,
function (arg) {
if
(arg ==
false
) {
// The user has confirmed moving the appointment. Update the start and end time.
appointment.set_start(fromTime);
appointment.set_end(newFromEndTime);
scheduler.updateAppointment(appointment, editSeries);
}
}, 330, 100);
}