An onion when frozen will last for likely a year or even longer as long as it remains frozen.
When you refrigerate the onion it will last up to 8 months in the refrigerator.
Onions can keep a long time in the freezer and refrigerator.
Onions when kept frozen at 0 F in the freezer are supposed to last and stay safe to eat indefinitely.
I've never really kept any onions longer than a year in the freezer because I eat them up or use them to cook with sooner than a year usually.
But sometimes I'll have some extra onions at the bottom of the freezer that I forgot about a year later and they've been okay.