CiviReport does not localize custom date fields when exporting to CSV
CiviReport does not localize custom fields of type Date
How to reproduce
- Set localization settings: Date Format Complete date to
%d-%m-%Y
- Add a custom group for cases
- Add a custom field of Type Date and no time.
- Enter a value such as 31-04-2021 (1st of april 2021)
- Create a new CiviCase detail report. Check the column to display the custom field.
- Export the report to CSV
Expected result
Value of the custom field displayed as 01-04-2021
as it is shown in the report and according to the localization setting.
Actual result
Value of custom field is displayed as 2021-04-01
which is ISO format.
Comment
The format for iso format is hard coded in: https://github.com/civicrm/civicrm-core/blob/master/CRM/Report/Utils/Report.php#L270
I am not sure if that is the desired behavior. I dont think so as the custom fields of type money are localized into a CSV export. So I would argue that the date should also be formatted according to the localization settings.