ISOString` will throw if the date is invalid,
    // so we can render an `Invalid Date` element.
    dateObject.toISOString();

    date = span(
      {
        "data-link-actor-id": grip.actor,
        className: "objectBox",
      },
      getTitle(grip),
      span({ className: "Date" }, dateObject.toString())
    );
  } catch (e) {
    date = span({ className: "objectBox" }, "Invalid Date");
  }

  return date;
}

function getTitle(grip) {
  return span(
    {
      className: "objectTitle",
    },
    `${grip.class} `
  );
}

// Registration
function supportsObject(grip, noGrip = false) {
  if (noGrip === true || !isGrip(grip)) {
    return false;
  }

  return getGripType(grip, noGrip) == "Date" && grip.preview;
}

// Exports from this module
module.exports = {
  rep: wrapRender(DateTime),
  supportsObject,
};
PK