Just my 2 cents:
def parsed(string) do
# some other code here
#...
# Problem: I need to parse xml document with multiple broken datetime formats
# to_date and to_date_time returns either value or nil
#
# string - source value
# value - parsed one
value = value || to_date_time(string)
value = value || if to_date(string), do:
to_date_time("#{string}T00:00:00+03:00")
value = value || if String.contains?(string, "+"), do:
String.replace(string, "+", "T00:00:00.000+") |> to_date_time()
value || string
end
I dont like this solution but atm Im ok with it


















