Fixed minpre/minpost calculation wich neither worked on hour borders nor on day borders