Iām having some issues with the format of dates that are included via variables into emails sent using a workflow. The whole setup is working great except the dates are coming through in US data format mm/dd/yyyy when I need it in UK format of dd/mm/yyyy.
The process is basically Events are scheduled using the events module, and then the workflows are setup to send an email automatically 7 days before the event. Within the email body it includes the variable $fp_events_date_start to insert the data of the event into the email.
So far I have done the following:
Checked the older forum posts, the most recent I found was this Wrong dateformat but nothing suggested seems to work / or be relevant.
Checked the suitecrm log files and no relevant entries
Checked the config.php and the following are set:
ādatefā => ād/m/Yā,
ādefault_date_formatā => ād-m-Yā,
Checked config_override.php and the following are set:
$sugar_config[ādefault_date_formatā] = ād-m-Yā;
Checked the php.ini and the only date setting I can see is the following:
date.timezone = āEurope/Londonā
I am now running out of ideas. Should there be any more date related settings in the php.ini? Are there any settings in the Admin interface for this?
All other dates appear in the correct format, itās just this one in the email sent by the workflow using this variable thatās wrong.
Having run the command in the command prompt it suggest 3 files none of which I have access to in my directory (shared hosting) so Iāll have to ask the hosting provider to check those for me. As for the diagnostics they are just sticking at 0% and not running, so looks like I have another issue to deal with there.
It does seem strange though that the exact same variable puts the date correctly into the invite email when used there, but formats it differently in the emails sent through the workflow. I donāt really understand why it would be setup like this, you would have thought it would make more sense to have dates formatted consistently throughout the system based on one central config setting.
I had to get the hosting provider to check the php.ini files and their feedback is:
āIāve checked and the date/timezone format for both PHP CLI and PHP CGI is set to Europe/London, so there should be no differences with how the date is formatted. Unfortunately Iām not too sure what else to suggest on this occasion other than manually amending the site code to display the desired format.ā
I went through the pending PRs but nothing seems to help. I even tried asking ChatGPT to see if it had any ideas on the problem and whilst it gave some surprisingly useful answers, they were all things I had already tried.
Unfortunately I donāt write php, so Iāve probably hit my limits now. If you think of anything else though please do let me know, as I am sending a lot of manual emails that this would let me avoid.
If you have a budget, you could consider sponsoring me on Github to get my PowerReplacer add-on, which would facilitate solving that, and add a bunch of other very useful possibilities to your email and Workflows. Links in my user profile.
If you have a smaller budget, not for a regular payment, but for a one-off gig, you could try paying someone (here, or from upwork, for example) to develop a fix. Itās probably not very hard.
At some point would love to get the PowerReplacer as it looks very useful, unfortunately no budget for it right now.
I sorted this in the end by simply adding a new text field to the events via the Studio, which is basically the start date (but as a text field rather than as a date field). It then means I can just insert that field into the email templates, rather than the actual event date itself.
It does mean I have to manually fill out an extra field with the date in it every time I setup a new event, but that only take a second so itās not a big deal for me. I guess there is also the risk of a typo where a date is entered wrong by me, but that could be argued for any field.
On the upside though it lets me automate all these email and avoid having to go through a list manually every day, working out which emails I need to send today based on events happening weeks or months from now.