I miss the days that I was trouble-free.
I know it would be correct if "that" is replaced by "when."
Also, I have this faint feeling that, both that and when can be used in adverbial clauses of time, and when "that" is used, the action described is often transient(the day she left), whereas when "when" is used, the action usually spans a period of time(the days when I had to walk home alone after school).
I'm confused and didn't find the answer after several searches.
Any help would be appreciated.