Method: NetSuite::Utilities#normalize_datetime_from_netsuite

Defined in:
lib/netsuite/utilities.rb

#normalize_datetime_from_netsuite(datetime) ⇒ Object

use when displaying times from a NS record



139
140
141
142
143
144
145
# File 'lib/netsuite/utilities.rb', line 139

def normalize_datetime_from_netsuite(datetime)
  # the code below eliminates the TimeZone offset then shifts the date forward 2 hours (7200 seconds)
  # this ensures that ActiveRecord is given a UTC0 DateTime with the exact hour that
  # was displayed in the NS UI (CST time zone), which will result in the correct display on the web side

  datetime.new_offset(0) + datetime.offset + Rational(2, 24)
end