How would you calculate the age of a non-flat universe?

I understand that you can calculate the age of the universe by taking the inverse of Hubble's constant, but this assumes a flat universe.

What happens if $k≠0$ and the universe's geometry is either open or closed? How is the age of the universe then calculated? Can it be done by taking into account the various cosmological density parameters?

I understand that you can calculate the age of the universe by taking the inverse of Hubble's constant, but this assumes a flat universe.

Not really. The dynamics of the scale factor can be obtained from Friedmann's equations

$${\frac {H^{2}}{H_{0}^{2}}}=\Omega _{0,R}a^{-4}+\Omega _{0,M}a^{-3}+\Omega _{0,k}a^{-2}+\Omega _{0,\Lambda } \tag{1}$$

This contains the effect of radiation ($\Omega_{0,R}$), matter ($\Omega_{0,M}$), dark energy/cosmological constant ($\Omega_{0,\Lambda}$) and curvature ($\Omega_{0,k}$)

$$\Omega _{0,k}=1-\Omega _{0} \tag{2}$$

For the current preferred model $\Omega_{0,M} \approx 0.23$, $\Omega_{0,\Lambda}\approx 0.77$ and $\Omega_{0,R}\approx 10^{-4}$, which leads to $\Omega_{0,k}= 0$. But in general you can solve Eqn. (1) to find the age of the universe

$$H(t) = \frac{{\rm d}a}{{\rm d}t} = H_0 \left[\Omega _{0,R}a^{-4}+\Omega _{0,M}a^{-3}+\Omega _{0,k}a^{-2}+\Omega _{0,\Lambda } \right]^{1/2} \tag{3}$$

and from there

$$t = \frac{1}{H_0}\int_0^1{\rm d}a~\left[\Omega _{0,R}a^{-4}+\Omega _{0,M}a^{-3}+\Omega _{0,k}a^{-2}+\Omega _{0,\Lambda } \right]^{-1/2} \tag{4}$$

It is true that

$$t\sim \frac{1}{H_0}$$

But that it is not the same as saying that the age of the universe is $1/H_0$