It is defined by day so, if you select from PM (afternoon/night) to AM (overnight/morning), the message will show up (as the definition of the time is incorrect).
You must set from AM (overnight/morning)to PM (afternoon/night) as this is the natural cycle of a day.
NOTE - The only condition where Teams will allow you to define PM before AM is when you need to select the 00:00 or the "24:00" after 11:59 (check my conclusion and you will understand).
In this case, I am guessing you want to set it from 11:30 PM (Sunday) until 8:30 AM (Monday). The overnight hour needs to be set on Monday.
Example, If you need to set the whole Sunday you must need to set from 12 AM (00:00) overnight until 12 PM (night) (so it will cover the 24 hours of the Sunday including the overnight).
Conclusion.
If my guess above is correct, you have to set this:
On Sunday, Set from 11:30 PM until 12 AM.
On Monday, Set from 12 AM until 8:30 AM.
I hope it helps to understand the set of the time on Teams.