Many investors struggle with this concept, unfortunately, and partly I think this is due to the concept of duration matching being somewhat abstract and difficult to visualize. Although there are endless nuances that can be modeled, it is nonetheless possible to construct a very reasonable estimate for an investor's investment horizon using a few simplifying assumptions. Luckily, the estimated investment horizon isn't overly sensitive to these assumptions so a fairly general result is pretty easy to obtain.
Because most investors are familiar with the concept of a glide path which illustrates the appropriate ratio of stocks and bonds at different ages (a glide path that is MORE sensitive to the underlying assumptions, by the way), I thought it might be useful to see what a bond duration glide path would look like.

This glide path illustrates a target bond duration over the investor's lifetime. The blue line assumes the use of a typical long-term bond index fund, most of which have weighted average durations of 19 years or less. Some investors may prefer to use a so-called "extended duration" bond fund, which can have an average duration up to 25 years or so, so I've included a separate line in the graph for that fund.
Just like an investor can match the stock/bond glide path by rebalancing between two or more funds (e.g. a stock fund and a bond fund), an investor can match the duration glide path by rebalancing between two or more bond funds (e.g. a long-term bond fund and a short-term bond fund) such that the average duration of the bond funds matches the glide path for a particular time horizon.
The graph essentially uses the investor's remaining life expectancy (with a small modification to account for the typical need to plan for slightly longer life than the actuarial average), a retirement age of approximately 65, and an assumption of flat retirement expenditures in real (inflation adjusted) terms.