I have to agree that the statement of an appropriate dress code is acceptable on such an occasion as that under discussion. In the not too distant past, people seemed to have a better knowledge of what is appropriate wear for such events. However, that knowledge and acceptance now seems to have been lost.
Indeed the lack of any sense of "suitability and smartness" in clothing, Is I feel a sad loss to our society, especially within my own gender, that being men. These days in pubs and restaurants men are all too often to be seen in shorts, flip-flops and slogan tee shirts that look as if they have been worn for many days without even being washed.
With women, the situation is better I believe, but even in that you still see on occasion instances of inappropriate dress, especially at funerals etc.
In workplace offices, the code of men having to wear suits and ties was generally relaxed a few years ago. However, many companies have now reinstated a written dress code of "smart casual" for both genders and laid out precisely what that clothing should consist of.
Many employers feel that they have been made to enforce the above due to the abuse that has taken place in recent times of the relaxation of the previous more strict dress code rules.