title: Formatting Strings to Datetime using specific formats in Luxon
body: <p>By now I used <code>moment-js</code> for time handling, but I want to switch to <code>Luxon</code>. But I have problems with the following implementation.</p>
  <p>There is a textfield where you can enter a datetime in your locale time format, for instance <code>HH:mm</code> (24h format) or <code>hh:mm</code> (12h format). The used time format is stored in the variable <code>timeFormat</code>.</p>
  <p>My solution with <code>moment-js</code>:</p>
  <pre><code>let timeFormat = 'HH:mm' // 'hh:mm a'
  let textfield = document.querySelector('#input-time');
  let timeString = textfield.value;
  let dateTime = moment(timeString, timeFormat, true);
  
  // Check if time is valid
  if(dateTime.isValid() === false){
      return;
  }
  </code></pre>
  <p>Using 12h-format:</p>
  <ul>
  <li><code>11:00 am</code>, <code>09:43 pm</code> are <strong>valid</strong>.</li>
  <li><code>11:00</code>, <code>21:43</code> are <strong>invalid</strong>.</li>
  </ul>
  <p>Using 24h-format:</p>
  <ul>
  <li><code>11:00 am</code>, <code>09:43 pm</code> are <strong>invalid</strong>.</li>
  <li><code>11:00</code>, <code>21:43</code> are <strong>valid</strong>.</li>
  </ul>
  <p>How can I aprove obtain a similar solution with <code>Luxon</code>? My biggest issue is to get a similar function to <code>moment(timeString, timeFormat, true)</code>, so formatting a String into a Datetime using a specific format, for instance 12h/24-format.</p>