rename DateUtils to UserTime

This commit is contained in:
Matt Rogers 2013-07-29 21:51:15 -05:00
parent 6c695aa61a
commit 8512e8db3b
6 changed files with 18 additions and 9 deletions

14
lib/user_time.rb Normal file
View file

@ -0,0 +1,14 @@
require 'active_support/values/time_zone'
class UserTime
attr_reader :user, :timezone
def initialize(user)
@user = user
@timezone = ActiveSupport::TimeZone[user.prefs.time_zone]
end
def midnight(date)
timezone.local(date.year, date.month, date.day, 0, 0, 0)
end
end