I actually gave 6 months notice. Didn't need to give so long but I was the only person doing the job and I made sure that those who would have to pick up some of the slack while a new person was trained knew all about what I did. I did a guide to the job and the yearly cycle for new person and anyone else who might be interested
As I had been umming and ahhing about whether or not to go when I did, it made it official and I couldn't change my mind, it also was a psychological thing for me as I detached from the job, bit by bit, thinking that's the last time I do this, or next year seone else will be doing this. And I also did things such as fill.im bits on the database that hadn't migrated across from old database but I had all the info in a doc that I used instead, so I entered all that, some of the stuff I had in my memory so I made sure that reminders would pulop up for new person, that sort of thing. I wanted the new person to have as easy a hand over as possible and stay in the job, didn't want the risk of the asking me to cover if they left!