Chopped onions can be chopped up as long as 2 days in advance of needing them as long as you put them in a tightly sealed glass container or a double-bagged resealable bag and refrigerate them.
If you want to chop the onions a week or more in advance of needing them you will need to place the onions in a freezer safe container or bag such as a Ziploc bag and then place them in the freezer.
Frozen chopped onions will last for up to a year.
I chop onions up all the time and freeze them too add to soups, stews, noodles etc so that I have the onions already chopped up well in advance.
All I have to do is remove the chopped onions from the freezer and place them into the food I'm cooking.