Fix datetime usage in memorize model