If you can be flexible, then I would say give them notice a few weeks before you actually want to leave, but be prepared to stay as long as 6 or 8 weeks. If you give notice SOONER, you may find yourself with an unexpected, unwelcome, and unrecoverable shortfall.
If you agree to stay a little longer than expected, you will only get additional respect, income
, and give your employer the benefit of getting to choose THEIR timetable, instead of being held hostage to yours.
I agree with the "leave of absence" request. Either that or say that you're off to start your own business, which has been a lifelong dream. Be prepared to answer those questions if you do that. I think the most important thing is to avoid the appearance that this was premeditated, and that suggests that you wait to give the news, and be flexible later.
An alternative is to fall on the sword now, offer to renounce your promotion saying that you realized you should not have accepted it knowing that you were planning to leave, and HOPE they don't quietly find an excuse to release you in 3 weeks.
I just don't like the second scenario.It will burn bridges. You will be asked for references
. It will make you an enemy of your current
boss. Maybe he'll get promoted, and then you'll be free to go!
All around, a sticky situation. You know your company. Quit while you are at a low point, when you are least critical, when there is the least demand for your immediate skills and knowledge, if you can. That will create a plus for your boss, who will then have the benefit of conducting a proper search for someone with finely tune background for the "next" project