Clean time selection code
Fix extended time selection in chart download