Data import error for CSV file related to date time

I am getting the following error while trying to import a CSV file, which I am not able to resolve or debug. Some entries are randomly getting updated successfully while others are failing. Some are partially updated while others are not. I am failing to see any logical reasoning behind this behaviour, probably the error msg might help:

Traceback (most recent call last):
File “apps/frappe/frappe/core/doctype/data_import/”, line 145, in import_data
doc = self.process_doc(doc)
File “apps/frappe/frappe/core/doctype/data_import/”, line 241, in process_doc
return self.update_record(doc)
File “apps/frappe/frappe/core/doctype/data_import/”, line 278, in update_record
File “apps/frappe/frappe/model/”, line 335, in save
return self._save(*args, **kwargs)
File “apps/frappe/frappe/model/”, line 371, in _save
File “apps/frappe/frappe/model/”, line 1089, in run_before_save_methods
File “apps/frappe/frappe/model/”, line 960, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
File “apps/frappe/frappe/model/”, line 1320, in composer
return composed(self, method, *args, **kwargs)
File “apps/frappe/frappe/model/”, line 1302, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
File “apps/frappe/frappe/model/”, line 957, in fn
return method_object(*args, **kwargs)
File “apps/erpnext/erpnext/selling/doctype/sales_order/”, line 180, in validate
File “apps/erpnext/erpnext/selling/doctype/sales_order/”, line 289, in validate_delivery_date
max_delivery_date = max(delivery_date_list) if delivery_date_list else None
TypeError: can’t compare datetime.datetime to

I cannot seem to find delivery_date_list what field is it for?

can you check your csv file… for the column Delivery Date… it should be a Date value, not datetime. delivery_date_list is just used to calculate maax delivery date while validating sales order

I tried to import after removing the delivery date column but still got the same errors, which made me even more confused. I selected date-time and date formats through the Google spreadsheet import option (as for some reason excel does not seem to have the date-time format) but it did not do anything. All other columns that I wanted to import got imported.

You probably can’t remove Delivery Date… why not put some fixed value in YYYY-MM-DD format for the delivery date column in the csv. if that works, then it means the date column needs to be set in correct format. also can try with one row with blank date, to see if it is mandatory