There are even people who consider 12am to be midnight at the start of a day and 12pm to be midnight at the end of that day.
The meaning of 12am,12pm, midday, midnight and the 24-hour clock
www.npl.co.uk
It is a simple matter to avoid most of the problem by using noon and midnight.
You can still have ambiguity about 'midnight on Monday' - is that the midnight at the start of Monday, or the next one at the end of Monday? That's easy to define by the 'insurance company' technique of using 11:59pm or 00:01am with the appropriate day.