generating ToJSON and FromJSON instances for Day (ripped from https://github.com/snoyberg/todolist/blob/master/Model.hs)