That is blatant age discrimination and should have been reported to the proper authorities.
It still burns me up a little but at that point I 100% understood his call and honestly not sure I would want to go all the way down the road fighting it too...
Which is perfectly legal, as long as the target isn't over 40.
This is what allows so much harassment (both general and sexual) to go unchecked. It's better to shut up, bag some amount of experience and move on to a better job than it is to actively fight against it.