Sharepoint hosted app where saving and reading data from sharepoint list.
Getting time to Datetimepicker and convert it to current timezone:
var Time1 = $('#TextBox_Startdate').val();
var Clock1 = $('#clock1').find(":selected").text();
var Time2 = $('#TextBox_Enddate').val();
var Clock2 = $('#clock2').find(":selected").text();
var convertDate1 = new Date(Time1);
var zone1 = convertDate1.getTimezoneOffset() * -1 / 60;
var convertDate2 = new Date(Time2);
var zone2 = convertDate2.getTimezoneOffset() * -1 / 60;
var datetime1 = Time1 + "T" + Clock1 + ":00+" + "0" + zone1;
var datetime2 = Time2 + "T" + Clock2 + ":00+" + "0" + zone2;
Camlquery:
"<And>" +
"<Leq>" +
"<FieldRef Name='datetimedata1' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + datetime1 + "</Value>" +
"</Leq>" +
"<Gt>" +
"<FieldRef Name='datetimedata2' /><Value Type='DateTime' IncludeTimeValue='TRUE'>" + datetime2 + "</Value>" +
"</Gt>" +
"</And>" +
Values to try to save:
datetime1 value = 2019-01-18T12:00:00+2
datetime2 value = 2019-01-18T13:00:00+2
Values already in list:
datetimedata1 value = 2019-01-18T11:00:00+2
datetimedata2 value = 2019-01-18T12:00:00+2
Problem: I don't want make doublebooking. Still query results "there is previously saved value!"
New starting time is -> datetime1 value = 2019-01-18T12:00:00+2 And already value in list ->datetimedata2 value = 2019-01-18T12:00:00+2
Could be same on lower.
I thougt they were the same but not. (seconds ?).