update datecompare function