I know the ratio of stocks and bonds is basically a personal choice based on your comfort level with risk. However, it can be helpful to have a general guide to start with.
A common answer is to subtract your age from 100 (or 110, or 120) to determine how much you should have in stocks. However, I've never heard if that is based on a specific retirement age? If I was 50 years old and planned to retire at 65, I might be willing to accept a bit more risk. But if I planned to retire at 55, I would probably want to reduce my risk.
Are there any allocation guidelines based on how many years till you retire, instead of how old you are?
I don't know of any. However, you are probably aware that when you retire, your paycheck stops and you are dependent on your nest egg, your pensions (if any), your SS, your rental income (if any), etc. This means you should think about liquidity. Liquidity is overlooked prior to retirement because your paycheck provides liquidity to meet your needs.
I suggest developing a post retirement budget. If it is $3,000 a month, then that is what your nest egg should provide as a minimum. The elephant in the room is a recession. Here is a useful link to review:
https://obliviousinvestor.com/what-happens-to-bonds-in-a-stock-market-crash/
People often assume their bonds provide a soft landing in a recession. However, the link above indicates what "type" of bonds that you have will determine your risk. If you have mostly high yield junk bonds then you may not have a soft landing.
If you have a total bond index fund as an example, I suggest you review the performance of your total bond index fund during the last recession or 2007 to 2009. If it is positive during those years, then you should be OK.
However, if it is negative, then I would suggest creating a "rainy" day cash fund. Some AA can be 50/40/10 which means 50% stock, 40% bonds, 10% cash, CD or treasury. The 10% provides additional liquidity. Be aware that too much liquidity also hurts overall performance. The balance between reward and risk should be up to that individual situation.