jQuery(function ($) {
  $(document).on("click", ".editinline", function () {
    const $tr = $(this).closest("tr");
    const expiration = $tr.find(".tw-lem-expiration-data").text().trim();
    const formatted = expiration ? expiration.replace(" ", "T") : "";
    $(".inline-edit-row .tw-lem-expiration-input").val(formatted);
  });
});

jQuery(document).ready(function ($) {
  const $quickEdit = $("body");

  $quickEdit.on("click", ".editinline", function () {
    const postId = $(this).closest("tr").attr("id").replace("post-", "");
    const expiration = $("#post-" + postId)
      .find(".tw-lem-expiration-data")
      .text()
      .trim();
    $('input[name="tw_lem_expiration"]').val(expiration);
  });
});
