fixed issue #75 related problems with dates very close to midnight