How can I use Google Apps Script to ensure the ‘end date’ in a Google Form is always later than the ‘start date’?

I’m using Google Apps Script to create and manage the form. In the script I’m creating a form with multiple sections based on district names. Each section has a trainingStartDate and a trainingEndDate for training.

I want to add a validation rule to ensure that the trainingEndDate is always later than the trainingStartDate. How can I achieve this in Google Apps Script?

const FORM_URL = "https://docs.google.com/forms/abcdefgh/edit"
let form = FormApp.openByUrl(FORM_URL)

function resetForm() {
  let items = form.getItems()
  items.forEach(item => form.deleteItem(item))
}

function createConditionalForm() {
  resetForm()
  
  let ws = SpreadsheetApp.getActiveSpreadsheet()
  let ss = ws.getSheetByName("DistBlock")
  let table = ss.getDataRange().getValues()
  table.shift()
  
  let districtOptions = table.map(row => row[0])
  let singleDistrictOptions = []
  districtOptions.forEach(option => {
    if (singleDistrictOptions.indexOf(option) == -1)
      singleDistrictOptions.push(option)
  })

  let districtQuestion = form.addMultipleChoiceItem().setTitle("District Name - जिले का नाम")
  let finalDistrictOptions = []

  singleDistrictOptions.forEach(districtOption => {
    let section = form.addPageBreakItem().setTitle(districtOption)
    section.setGoToPage(FormApp.PageNavigationType.SUBMIT)
    let blockQuestion = form.addMultipleChoiceItem().setTitle(districtOption)
    let blockOptions = table.filter(option => option[0] == districtOption).map(row => row[1])
    blockQuestion.setChoiceValues(blockOptions)

    // Add your real questions here
    let trainingStartDate = form.addDateItem().setTitle('Training started on (date) प्रशिक्षण प्रारंभ हुआ (तारीख)').setRequired(true);
    let trainingEndDate = form.addDateItem().setTitle('Training ends on (date) प्रशिक्षण समाप्त हुआ (तारीख)').setRequired(true);
    let schoolName = form.addTextItem().setTitle('School Name स्कूल का नाम').setRequired(true);

    let districtChoice = districtQuestion.createChoice(districtOption, section)
    finalDistrictOptions.push(districtChoice)
  })
  
  districtQuestion.setChoices(finalDistrictOptions)
}