fix for time zones
This commit is contained in:
parent
8f869c8e4d
commit
3194764c46
|
@ -285,11 +285,13 @@ var AgendaView = function(calendar){
|
|||
var eventsManager = function(){
|
||||
var url = "/xhr/calendars/agenda",
|
||||
sd = new Date(start_year,start_month,1),
|
||||
ed = new Date(end_year,end_month+1,0);
|
||||
ed = new Date(end_year,end_month+1,0),
|
||||
usd = Math.round(sd/1000),
|
||||
ued = Math.round(ed/1000);
|
||||
$.ajax({
|
||||
type : "get",
|
||||
url : url,
|
||||
data : {"agenda_start":sd.toLocaleString(),"agenda_end":ed.toLocaleString(),"page_id" : _calendar.page_id},
|
||||
data : {"agenda_start":sd.toLocaleString(),"agenda_end":ed.toLocaleString(),"page_id" : _calendar.page_id,"unix_start":usd,"unix_end":ued},
|
||||
success : function(events){
|
||||
$.each(events,function(i,e){
|
||||
var ed = eventDom(e),
|
||||
|
|
|
@ -34,8 +34,8 @@ class Admin::CalendarsController < OrbitAdminController
|
|||
end
|
||||
|
||||
def agenda
|
||||
agenda_start = Date.strptime(params[:agenda_start], '%m/%d/%Y')
|
||||
agenda_end = Date.strptime(params[:agenda_end], '%m/%d/%Y')
|
||||
agenda_start = Time.at(params[:unix_start].to_i).to_s
|
||||
agenda_end = Time.at(params[:unix_end].to_i).to_s
|
||||
@events = Event.agenda_events(agenda_start,agenda_end)
|
||||
# re = Event.recurring_event(Time.at(params[:unix_start].to_i), Time.at(params[:unix_end].to_i))
|
||||
# @events = @events.inject(re, :<<)
|
||||
|
|
|
@ -45,9 +45,9 @@ class CalendarsController < ApplicationController
|
|||
else
|
||||
calendar_types = CalendarType.where(:category_id.in => categories).collect{|ct| ct.id.to_s } rescue []
|
||||
end
|
||||
if params[:agenda_start].present? && params[:agenda_end].present?
|
||||
agenda_start = Date.strptime(params[:agenda_start], '%m/%d/%Y')
|
||||
agenda_end = Date.strptime(params[:agenda_end], '%m/%d/%Y')
|
||||
if params[:unix_start].present? && params[:unix_end].present?
|
||||
agenda_start = Time.at(params[:unix_start].to_i).to_s
|
||||
agenda_end = Time.at(params[:unix_end].to_i).to_s
|
||||
events = Event.agenda_events(agenda_start,agenda_end).where(:calendar_type_id.in => calendar_types)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue