Fix #274

Fix #274 and replace #310 
Should be datetime instead of str