Formality understanding is crucial as it is the factor that contributes highly to social acceptability or awkwardness. Of course it is always better for you to dress well without any concerns on daily life and every occasion, but you should always be careful about how you dress up.
There are many events i go where a lot of people have no idea about what is appropriate to wear. I’ve seen people wearing t-shirt at weddings, jeans at formal dinners, sandals at funerals, and joggers at offices. Well… that’s funny and by going like that you are not respecting the hosts, and dishonoring the events.