stringify func now accepts strings as well as dates
sending error message as json