Fix a date parameter bug, add tests cases.

Also fix documentation.