fixed cache date calculation