Fixed Date Argument Issues in toStartOfDay Function

Fixed unexpected results of passing the Date argument to toStartOfDay .