+-- | (Un)pickle a UTCTime without the date portion. This differs from
+-- 'xp_time' in that it uses periods in the AM/PM part, i.e. \"A.M.\"
+-- and \"P.M.\" It also doesn't use padding for the \"hours\" part.
+--
+-- Examples:
+--
+-- * \<CurrentTimeStamp\>11:30 A.M.\</CurrentTimeStamp\>
+--
+xp_time_dots :: PU UTCTime
+xp_time_dots =
+ (to_time, from_time) `xpWrapMaybe` xpText
+ where
+ -- | The hours arent padded with zeros.
+ nopad_time_format :: String
+ nopad_time_format = "%-I:%M %p"
+
+ to_time :: String -> Maybe UTCTime
+ to_time = (parseTime defaultTimeLocale nopad_time_format) . (replace "." "")
+
+ from_time :: UTCTime -> String
+ from_time t =
+ replace "AM" "A.M." (replace "PM" "P.M." s)
+ where
+ s = formatTime defaultTimeLocale nopad_time_format t
+
+