Notification Regular AM/PM instead of Military hour. Hours Type-In locked

my contact form has an event start time and end time the hours displayed are AM/PM

but when we receive new form notification it gets converted to military, and there is not way to toggle that off, but last month it used to be AM/PM see below. I think @Max help me fixed than when an event started on 9/26 at 7PM and the end time says 10AM system will assumed automatically that it is a next day, and was working fine. MAybe if this internally mechanisms in the code, is there a way to be converted into AM/PM for just the notifications.

One last thing, is there a way to lock people from type in the time 15, or 30 min interval is better for us than people type in 10:06 (see screenshot from notification email) they need to choose from the drop down. I mean they can still type it in, to search for specific hour, and select from drop down, but not as custom input

Thank you! :blush:

Hello there, @Norton :waving_hand:

Apologies for the delayed response!

I am glad to say that it’s possible to block the manual time input. For this, please add this script to the Custom JS field on the Settings tab of your widget’s settings and let me know how it worked:

const TARGET_LABELS = ['Event Start Time', 'Event End Time'];

function listener(selector, callback) {
  const firstTarget = document.querySelector(selector);
  if (firstTarget) {
    return callback(firstTarget);
  }

  const observer = new MutationObserver((_, observer) => {
    const targetNode = document.querySelector(selector);
    if (targetNode) {
      observer.disconnect();
      callback(targetNode);
    }
  });
  observer.observe(document.body, { childList: true, subtree: true });
}

function updateTimes(container) {
  const dropdownFields = Array.from(
    container.querySelectorAll('.es-fields-text-dropdown-text-control') ?? []
  );
  const targetFields = dropdownFields.filter((field) => {
    const label = field.querySelector('label');
    return TARGET_LABELS.includes(label?.textContent.replace('*', '').trim());
  });
  if (!targetFields.length) {
    return;
  }

  targetFields.forEach((field) => {
    const input = field.querySelector('input');
    input.readOnly = true;
  });
}

listener('[class*="Content__FormContainer-sc"]', (container) => {
  const mo = new MutationObserver(() => {
    updateTimes(container);
  });
  mo.observe(container, { childList: true });

  updateTimes(container);
});

Regarding the time format in the submissions, I’ve just checked it and it’s displayed correctly on my end:

Could you please check it once again? If the issue still persists please send me a screenshot of how the submissions look on your side :folded_hands:

@Max welcome back from your vacation, I do not know if this was resolve by Tony or for somebody else but was fixed 2 days after this was posted because we got this event

It was kinda strange to have a birthday party, for 7hrs, also the person custom type the hours, even though we only have schedule for every 15 mins intervals, that is reason I told you to lock the custom type in for client to just select from drop down

@Max I did added the previous code and still was able to type in the time

Just in case, I’d like to note that the Custom JS create work only when testing the widget on the website where it’s installed.

If you tested the widget on the website (not just in the editor) and the code didn’t work, please send me a link to the page where your widget is installed. I’ll be happy to check things :slightly_smiling_face: