Add startParamUTC and endParamUTC options

This commit is contained in:
Jorge López Pérez 2011-10-24 14:23:31 +02:00
parent 477c2960a8
commit c0e8970c66

View file

@ -36,6 +36,7 @@ function EventManager(options, _sources) {
var stickySource = { events: [] };
var sources = [ stickySource ];
var rangeStart, rangeEnd;
var offsetStart, offsetEnd;
var currentFetchID = 0;
var pendingSourceCnt = 0;
var loadingLevel = 0;
@ -60,6 +61,8 @@ function EventManager(options, _sources) {
function fetchEvents(start, end) {
rangeStart = start;
rangeEnd = end;
offsetStart = start.getTimezoneOffset()*60*1000;
offsetEnd = end.getTimezoneOffset()*60*1000;
cache = [];
var fetchID = ++currentFetchID;
var len = sources.length;
@ -130,10 +133,18 @@ function EventManager(options, _sources) {
var startParam = firstDefined(source.startParam, options.startParam);
var endParam = firstDefined(source.endParam, options.endParam);
if (startParam) {
data[startParam] = Math.round(+rangeStart / 1000);
var tmpstart = rangeStart;
if (source.startParamUTC) {
tmpstart -= offsetStart;
}
data[startParam] = Math.round(+tmpstart / 1000);
}
if (endParam) {
data[endParam] = Math.round(+rangeEnd / 1000);
var tmpend = rangeEnd;
if (source.endParamUTC) {
tmpend -= offsetEnd;
}
data[endParam] = Math.round(+tmpend / 1000);
}
pushLoading();
$.ajax($.extend({}, ajaxDefaults, source, {