I have a site with a calendar. In the calendar I have a mix of recurring and non-recurring events.
On a WebPart page I have a CEWP that uses WebServices (_vti_bin/Lists.asmx?op=GetListItems
) through JavaScript to get a list of those events for a specific month (a la https://sharepoint.stackexchange.com/questions/160778/daterangesoverlap-to-show-events-for-last-month-in-a-dvwp). So I have a list of dates like so:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="..." xmlns:xsi="..." xmlns:xsd="...">
<soap:Body>
<GetListItemsResponse xmlns="...">
<GetListItemsResult>
<listitems xmlns:s='...' xmlns:dt='...' xmlns:rs='...' xmlns:z='...'>
<rs:data ItemCount="1">
<z:row
ows_Title='recurring meeting one'
ows_EventDate='2016-01-26 11:00:00'
ows_EndDate='2016-01-26 12:00:00'
ows_Description='...'
ows_fRecurrence='1'
ows_RecurrenceData='...'
ows_fAllDayEvent='0'
ows__ModerationStatus='0'
ows__Level='1'
ows_ID='2.0.2016-01-26T16:00:00Z'
ows_UniqueId='...'
ows_owshiddenversion='2'
ows_FSObjType='2;#0'
ows_Created='2015-10-22 08:34:47'
ows_PermMask='0x7fffffffffffffff'
ows_Modified='2015-10-22 09:22:05'
ows_FileRef='2;#/xxx/Lists/Meeting Calendar/2_.000'
ows_MetaInfo='2;#' />
</rs:data>
</listitems>
</GetListItemsResult>
</GetListItemsResponse>
</soap:Body>
</soap:Envelope>
What I'm trying to do now is iterate over each event to see if it is occurring right now.
I could use new Date()
to get the date now, but that would be for the client's timezone/settings. The SharePoint site may use a different regional setting. And, the user's regional settings may inherit from the site or the user may have their own regional setting -- both of which would effect the output from the GetListItems
call.
Ideally I'd love a way to get the current time accounting for, in order:
- the user's regional settings
- the site's regional settings if the user is inheriting from the site
Any thoughts/ideas?