function parseDate(...args) {
  let date
  if (args.length >= 2) {
    // always use strict mode if format arg is supplied
    date = dayjs(...args, true)
  } else {
    date = dayjs(...args)
  }
  if (!date.isValid()) {
    throw new InvalidResponse({ prettyMessage: 'invalid date' })
  }
  return date
}
Parse and validate a string date into a dayjs object. Use this helper
in preference to invoking dayjs directly when parsing a date from string.

@param {...any} args - Variadic: Arguments to pass through to dayjs
@returns {dayjs} - Parsed object
@throws {InvalidResponse} - Error if validation fails
@see https://day.js.org/docs/en/parse/string
@see https://day.js.org/docs/en/parse/string-format
@see https://day.js.org/docs/en/parse/is-valid
@example
parseDate('2024-01-01')
parseDate('31/01/2024', 'DD/MM/YYYY')
parseDate('2018 Enero 15', 'YYYY MMMM DD', 'es')