use datetime var instead of string when checking duplicates