code: function initJsonDateFormat (bookshelfModel) {
    const schema = bookshelfModel.prototype.schema
    const originalFunction = bookshelfModel.prototype.toJSON
    // read from MySQL date, based on https://github.com/tgriesser/bookshelf/issues/246#issuecomment-35498066
    bookshelfModel.prototype.toJSON = function () {
      const attrs = originalFunction.apply(this, arguments)
      _.forEach(attrs, function(v, k) {
        if (v !== null && typeof schema[k] !== 'undefined' && schema[k]._type === 'date') {
          attrs[k] = moment(v).format(schema[k]._flags.format)
        }
      })
      return attrs
    }
  }
docs: Initializes bookshelfModel's toJSON functionality to convert all date properties, as defined in bookshelfModel.schema.