Capture the point for children

That's the great advantage of the state-machine approach.

While the button is pressed but the time has not elapsed the system will be in one state
If the button is released without reaching the elapsed time it will switch to whatever other state you want. Something like this pseudo code

if (state == 'H') {
  if ( buttonBstate == LOW){  // assumes LOW = pressed
     state = 'J'
     startStateJmillis = millis()
  }
}
if (state == 'J') {
  if (buttonBstate == HIGH) { // button released
    stateJdurationMillis = millis() - startStateJmillis

    if (stateJdurationMillis > requiredStateJduration) {
       // go on to next state
    }
    else {
        // revert to some earlier state
    }
  }
}

And, an important point, I am assuming this code is called very frequently and the buttonStates are updated very frequently.

...R