-- | Strips off local times and changes them to midnight.  Some
-- financial institutions report transactions with a local time (often
-- it is an arbitrary time).  Use this if you don't care about the
-- local time.  You might want to first use 'toUTC' to get an accurate
-- UTC date before stripping off the time.
toMidnight :: Time.ZonedTime -> Time.ZonedTime
toMidnight
  = Lens.set (localTime . Timelens.todHour) 0
  . Lens.set (localTime . Timelens.todMin) 0
  . Lens.set (localTime . Timelens.todSec) 0
  where
    localTime = Timelens.zonedTimeToLocalTime . Timelens.localTimeOfDay

-- | Examines the OFX payee information to determine the best test to
-- use as a simple payee name.  OFX allows for two different kinds of
-- payee records.  This function examines the OFX and reduces the
-- payee record to a simple text or, if there is no payee information,
-- returns an empty Text.
toMidnight :: Time.ZonedTime -> Time.ZonedTime
toMidnight
  = Lens.set (localTime . Timelens.todHour) 0
  . Lens.set (localTime . Timelens.todMin) 0
  . Lens.set (localTime . Timelens.todSec) 0
  where
    localTime = Timelens.zonedTimeToLocalTime . Timelens.localTimeOfDay

-- | Examines the OFX payee information to determine the best test to
-- use as a simple payee name.  OFX allows for two different kinds of
-- payee records.  This function examines the OFX and reduces the
-- payee record to a simple text or, if there is no payee information,
-- returns an empty Text.
toMidnight
  = Lens.set (localTime . Timelens.todHour) 0
  . Lens.set (localTime . Timelens.todMin) 0
  . Lens.set (localTime . Timelens.todSec) 0
  where
    localTime = Timelens.zonedTimeToLocalTime . Timelens.localTimeOfDay

-- | Examines the OFX payee information to determine the best test to
-- use as a simple payee name.  OFX allows for two different kinds of
-- payee records.  This function examines the OFX and reduces the
-- payee record to a simple text or, if there is no payee information,
-- returns an empty Text.