This function will create a JavaScript date object from the date and time values from a SharePoint form. The form can be either the “new” form or “edit” form.

The datetime values produced by this method can be used to compare and filter calendar events.


spcalpro.getDateTimesFromForm(dateTimeRow1, dateTimeRow2)


The two parameters accept integers which specify the index the datetime rows appear on the form. dateTimeRow1 is the start datetime, dateTimeRow2 is the end datetime.

By default the start datetime and end datetime are the first and second datetime rows to appear on a SharePoint form. Therefore the indices of these two rows that the getDateTimesFromForm function would accept are 0 and 1. If the start and end datetimes were the 3rd and 4th datetime rows on the form, then the two parameters would be 2 and 3.


If we wanted to create start and end JavaScript datetime objects from the form below, this would simply look like:

    listName: "StaffSchedule",      
    userDateTimes: spcalpro.getDateTimesFromForm(0,1)
}).ready(function(data, obj) {
    if (obj.error) console.error(obj);