BOISE, Idaho (AP) — Legislation requiring voters to choose a political party three months before a presidential primary headed to the Senate on Wednesday.

The House voted 66-3 to approve the measure that would change current law that allows voters to switch parties right up to the day of the presidential primary.

Democrats allow Democrats and unaffiliated voters to participate in their presidential primary. Republicans only allow Republicans to take part.

The legislation replaced a previous version that would have retroactively put in place the 90-day requirement and potentially prevented thousands of voters from participating.

The new legislation, if it becomes law, won’t take effect until this summer.