I have two arrays 1 for EventDate and One for Endate from my calender List,
var listItemEnumerator = collListItem.getEnumerator();
while (listItemEnumerator.moveNext()) {
var oListItem = listItemEnumerator.get_current();
var array = new Array(oListItem.get_item('EventDate'));
var array2 = new Array(oListItem.get_item('EndDate'));
I have also two items in my calender list. That have Eventdate and EndDate.
Here i create to new Date();
var firstNewdt= new Date();
var start = new Date();
Then i am trying to find the items in my first "array" also with my other "array2" to get the time that are in my list.
Then i am look in an if statement if firstNewDt.getTime() != dt.getTime()&& start!=dt2.getTime()
If the values from my list matches the first item in the list display an alert with text busy to the user else display firstNewDt and Start.
Here is my code,
var firstNewdt= new Date();
var start = new Date();
for (var i = 0; i < array.length; i++) {
var date = array[i];
var dt = new Date(date);
for (var ii = 0; ii < array2.length; ii++) {
var date2 = array2[ii];
var dt2= new Date(date2);
if (firstNewDt.getTime() != dt.getTime() && start.getTime() != dt2.getTime()) {
alert(firstNewDt + " " + start);
} else {
alert("Busy");
}
}
}
Right now only the first item display "busy" that exists in the list the second wont because my value doesn't change in my dt and dt2 don't not why
Regards.

0 commentaires:
Enregistrer un commentaire