To handle edge cases where Usergrid.init() fails.
lots of date arithmetic, none of it documented, which seemd to go round the block and end up where it started. Converting a number to a Date() object, then converting that to a string, then replacing dashes in that string with slashes, converting the result back to another Date() object. It was all very obtuse. On my browser it resulted in all messages being formatted as "just now" which is obviously wrong. I simplified and it seems to work better now.