mirror of
https://github.com/TracksApp/tracks.git
synced 2025-09-22 05:50:47 +02:00
14 lines
291 B
Ruby
14 lines
291 B
Ruby
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
|