Class: ErpBaseErpSvcs::Helpers::Time::Client
- Inherits:
-
Object
- Object
- ErpBaseErpSvcs::Helpers::Time::Client
- Defined in:
- lib/erp_base_erp_svcs/time_zone_helper.rb
Instance Method Summary collapse
- #beginning_of_day ⇒ Object
- #beginning_of_week ⇒ Object
- #client_to_utc_time(time) ⇒ Object
- #end_of_day ⇒ Object
- #end_of_week ⇒ Object
- #in_client_time(time) ⇒ Object
-
#initialize(client_utc_offset = nil) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(client_utc_offset = nil) ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/erp_base_erp_svcs/time_zone_helper.rb', line 7 def initialize(client_utc_offset=nil) @offset_in_hours = get_offset_in_hours(client_utc_offset) end |
Instance Method Details
#beginning_of_day ⇒ Object
19 20 21 |
# File 'lib/erp_base_erp_svcs/time_zone_helper.rb', line 19 def beginning_of_day (::Time.now + @offset_in_hours.hours).beginning_of_day end |
#beginning_of_week ⇒ Object
27 28 29 |
# File 'lib/erp_base_erp_svcs/time_zone_helper.rb', line 27 def beginning_of_week (::Time.now + @offset_in_hours.hours).beginning_of_week end |
#client_to_utc_time(time) ⇒ Object
15 16 17 |
# File 'lib/erp_base_erp_svcs/time_zone_helper.rb', line 15 def client_to_utc_time(time) time - @offset_in_hours.hours end |
#end_of_day ⇒ Object
23 24 25 |
# File 'lib/erp_base_erp_svcs/time_zone_helper.rb', line 23 def end_of_day (::Time.now + @offset_in_hours.hours).end_of_day end |
#end_of_week ⇒ Object
31 32 33 |
# File 'lib/erp_base_erp_svcs/time_zone_helper.rb', line 31 def end_of_week (::Time.now + @offset_in_hours.hours).end_of_week end |
#in_client_time(time) ⇒ Object
11 12 13 |
# File 'lib/erp_base_erp_svcs/time_zone_helper.rb', line 11 def in_client_time(time) time + @offset_in_hours.hours end |