properly serializing dates in JSON