Tidy up code with jsFormat
Fix "off by one day" bug