mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
rename DateUtils to UserTime
This commit is contained in:
parent
6c695aa61a
commit
8512e8db3b
6 changed files with 18 additions and 9 deletions
14
lib/user_time.rb
Normal file
14
lib/user_time.rb
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue