i'm trying to use conditional formatting based on dates in 2 different cells

guidelines
if date1 is less than date2-8: date1 should be green
if date1 is between date2-date2-7: date1 should be yellow
if date1 is equal or greater than date2: date1 should be red

example: date1 is 5/13
date2 = 5/5 or earlier will be green
date2 = 5/6 through 5/12 will be yellow
date2 = 5/13 or later will be red

thank you!