Fix a bug in the handling of the least diff days