There was a bug that would only manifest itself in some cases, for example if a single digit date event was added after a multiple digit date event. So in most cases, it was working properly, but sometimes, like in your screenshot, it would show 31
before 3
within the same month.
This should fix it once it is merged: FIX: Correctly order events in upcoming events list by pmusaraj · Pull Request #34526 · discourse/discourse · GitHub