vinsol / fullcalendar-rails-engine

Rails engine implementation of fullcalendar jQuery plugin(http://arshaw.com/fullcalendar/). Create, edit, delete, reschedule, resize events like google calendar.
http://vinsol.com/fullcalendar-demo
MIT License
66 stars 51 forks source link

get_events api not returning events #13

Closed Liooo closed 8 years ago

Liooo commented 9 years ago

get_events action isn't correctly parsing start_time and end_time.

The code is currently as following

def get_events
    start_time = Time.at(params[:start].to_i).to_formatted_s(:db) #=> "1970-01-01 09:33:34"
    end_time   = Time.at(params[:end].to_i).to_formatted_s(:db) #=> "1970-01-01 09:33:34"

(This is because "2014-08-31".to_i returns 2014.)

but should be

def get_events
    start_time = Time.parse(params[:start]).to_formatted_s(:db)
    end_time = Time.parse(params[:end]).to_formatted_s(:db)

My environment was as following. rails version: 4.0.0 ruby version: ruby 2.0.0p353

pattersonc commented 9 years ago

+1

kuldeepaggarwal commented 8 years ago

Thanks for reporting this issue. will fix it.

kuldeepaggarwal commented 8 years ago

Actually get_events expects start & end to be an integer converted time. for e.g:

{
  "start": 1459621800,
  "end": 1460226600
}
kuldeepaggarwal commented 8 years ago

So I am closing this issue. Please reopen this if you think that it is not working as per this behaviour.