Fix datetime truncate for day period

closes #881