fn update_states(&mut self) {
        let out_date = Date::from_str(self.out_flight.as_str());
        let in_date = Date::from_str(self.in_flight.as_str());

        // out flight must either be standard or invalid
        match out_date {
            Ok(_) => {
                self.out_state = TboxState::Standard;
            },
            Err(_) => self.out_state = TboxState::Invalid,
        }

        if self.return_flight {
            match in_date {
                Ok(date) => {
                    if out_date.is_ok() && date.is_before(&out_date.unwrap()) {
                            self.in_state = TboxState::Invalid;
                    } else {
                        // we don't want to throw an error here if out flight is invalid
                        self.in_state = TboxState::Standard;
                    }
                },
                Err(_) => self.in_state = TboxState::Invalid,
            }
        }
        // if not a return flight in state must be disabled
        else {
            self.in_state = TboxState::Disabled
        }
    }
// To update the text box states based on their inputs
To update the text box states based on their inputs
To update the text box states based on their inputs
fn update_states(&mut self) {
        let out_date = Date::from_str(self.out_flight.as_str());
        let in_date = Date::from_str(self.in_flight.as_str());
        // out flight must either be standard or invalid
        match out_date {
            Ok(_) => {
                self.out_state = TboxState::Standard;
            },
            Err(_) => self.out_state = TboxState::Invalid,
        }
        if self.return_flight {
            match in_date {
                Ok(date) => {
                    if out_date.is_ok() && date.is_before(&out_date.unwrap()) {
                            self.in_state = TboxState::Invalid;
                    } else {
                        // we don't want to throw an error here if out flight is invalid
                        self.in_state = TboxState::Standard;
                    }
                },
                Err(_) => self.in_state = TboxState::Invalid,
            }
        }
        // if not a return flight in state must be disabled
        else {
            self.in_state = TboxState::Disabled
        }
    }
fn update_states ( & mut self ) { let out_date = Date :: from_str ( self . out_flight . as_str ( ) ) ; let in_date = Date :: from_str ( self . in_flight . as_str ( ) ) ; // out flight must either be standard or invalid match out_date { Ok ( _ ) => { self . out_state = TboxState :: Standard ; } , Err ( _ ) => self . out_state = TboxState :: Invalid , } if self . return_flight { match in_date { Ok ( date ) => { if out_date . is_ok ( ) && date . is_before ( & out_date . unwrap ( ) ) { self . in_state = TboxState :: Invalid ; } else { // we don't want to throw an error here if out flight is invalid self . in_state = TboxState :: Standard ; } } , Err ( _ ) => self . in_state = TboxState :: Invalid , } } // if not a return flight in state must be disabled else { self . in_state = TboxState :: Disabled } }
To update the text box states based on their inputs
To update the text box states based on their inputs
&mut self