Hello friend,
Rainwater is definitely the best option for waterings plants, it has so many amazing benefits that you just don't get from the tap or a bottle. However taking care of your reservoir is so important. If you can empty and clean it at least once every couple weeks that'll help stay clean and less smells, you can also use a small amount of vegetable oil and chlorine tablets to help keep contaminants and mosquitoes at bay.
I know chlorine isn't exactly desirable but if your growing plants that might be used for edibles it can be a good choice to battle those specific contaminants.
Technically the water can last anywhere from a week to forever, but it's all in how you care for it, the absolute best thing you can do for longevity is keeping the reservoir in a cold, dry place....the colder it is the less microbial life and negative things develop. Keeping the roof clean or wherever the runoff site is, is very important too.
Happy growing. ✌️