src/datetime.js
function parseDataToDateTime(parsed, parsedZone, opts, format, text) {
  const { setZone, zone } = opts;
  if (parsed && Object.keys(parsed).length !== 0) {
    const interpretationZone = parsedZone || zone,
      inst = DateTime.fromObject(
        Object.assign(parsed, opts, {
          zone: interpretationZone,
          // setZone is a valid option in the calling methods, but not in fromObject
          setZone: undefined
        })
      );
    return setZone ? inst : inst.setZone(zone);
  } else {
    return DateTime.invalid(
      new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
    );
  }
}
function parseDataToDateTime(parsed, parsedZone, opts, format, text) {
  const { setZone, zone } = opts;
  if (parsed && Object.keys(parsed).length !== 0) {
    const interpretationZone = parsedZone || zone,
      inst = DateTime.fromObject(
        Object.assign(parsed, opts, {
          zone: interpretationZone,
          // setZone is a valid option in the calling methods, but not in fromObject
          setZone: undefined
        })
      );
    return setZone ? inst : inst.setZone(zone);
  } else {
    return DateTime.invalid(
      new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
    );
  }
}
function parseDataToDateTime ( parsed , parsedZone , opts , format , text ) { const { setZone , zone } = opts ; if ( parsed && Object . keys ( parsed ) . length !== 0 ) { const interpretationZone = parsedZone || zone , inst = DateTime . fromObject ( Object . assign ( parsed , opts , { zone : interpretationZone , // setZone is a valid option in the calling methods, but not in fromObject setZone : undefined } ) ) ; return setZone ? inst : inst . setZone ( zone ) ; } else { return DateTime . invalid ( new Invalid ( "unparsable" , ` ${ text } ${ format } ` ) ) ; } }
helper useful in turning the results of parsing into real dates by handling the zone options
helper useful in turning the results of parsing into real dates by handling the zone options