I would like to calculate for Air time.

I would like to get the time starting from when I left the ground which I can check with my isGrounded bool, to when I touch the floor again so that I will be able to stop the jumping animation when I touch the floor instead of using the invoke method.

public float airDuration;

        Update()
  {
        
        if(isGrounded == false)
        {
        airDuration += Time.deltaTime;
        Debug.Log(airDuration);
        }
        else
        {
     airDuration = Time.deltaTime; // or zero
        }
  }

Untested.