Refactor date and time functions, `format_date` and `date_to_unix_ts`, in the rule engine to fix the implementation problem.