When did the people repent for worshiping the golden calf?

Before Moses returned.

7: 148-150

And the folk of Moses, after (he left them), chose a calf (for worship), (made) out of their ornaments, of saffron hue, which gave a lowing sound. Saw they not that it spake not unto them nor guided them to any way? They chose it, and became wrong-doers. And when they feared the consequences thereof and saw that they had gone astray, they said: Unless our Lord have mercy on us and forgive us, we verily are of the lost. And when Moses returned unto his people....

After Moses returned.

20: 88-91

Then he produced for them a calf, of saffron hue, which gave forth a lowing sound. And they cried: This is your god and the god of Moses, but he hath forgotten. See they not, then, that it returneth no saying unto them and possesseth for them neither hurt nor use? And Aaron indeed had told them beforehand: O my people! Ye are but being seduced therewith, for lo! your Lord is the Beneficent, so follow me and obey my order. They said: We shall by no means cease to be its votaries till Moses return unto us.

When did the people repent for worshiping the golden calf?

"And when" on the second verse is not reffering to an event that comes afterward, but moreso only referring to an event which happened. In some other translations the "And when" is translated as "In the meantime".

So... "when they feared the consequences thereof and saw that they had gone astray" was at the same time Moses came back. They aren't separate events. They feared the consequences and saw that they went astray at the time Moses came back. It wasn't at their own conscience. The following verse even states...

"And when Moses returned unto his people, angry and grieved, he said: Evil is that (course) which ye took after I had left you. Would ye hasten on the judgment of your Lord ? And he cast down the tablets, and he seized his brother by the head, dragging him toward him. He said: Son of my mother! Lo! the folk did judge me weak and almost killed me. Oh, make not mine enemies to triumph over me and place me not among the evil-doers."

Hence you can see Aaron (Moses brother) failed in trying to get them to repent in Moses' absence.

They aren't separate events, they have never been believed to be separate events, nor is there any reason to believe so. The other verse compliments the verse, rather than contradicts it.(BowOfHak)

Want to know more about a chapter or a verse from the Quran? Click Here