I currently have separate game_date and game_time fields and I am having a hell of a time comparing my DateTime.now to a concatenated DateTime because of time zone issues. Should I redesign my database to just use DateTime? I have a time field separately because the time can be NULL at some points in time. What is the typical practice, and also, how should I resolve my issue with the time zones below?
now = DateTime.now
@upcoming_games = []
@past_games = []
games.each do |game|
game.game_time = DateTime.now if game.game_time.nil?
dt = DateTime.parse("#{game.game_date}T#{game.game_time.strftime("%H:%M:00")}")
if dt >= now
@upcoming_games << game
else
@past_games << game
end
end