Replace naive logic in reldate filter