Page 1 of 1

How To Show Dates In Another Calendar System?

Posted: Wed Apr 04, 2018 10:25 am
by ethelena
I want to change dates shown everywhere in processmaker to another format(Persian calendar). I have my custom class to format dates. What is the best way to override the default function which returns the formatted date? I just found the CurDate method in the G class. Changed it's returned value but dates are still shown in gregorian format. Is there any other method for formatting dates?


I prefer an OOP solution to override the default function instead of hacking the core, if possible.

Thanks.

Re: How To Show Dates In Another Calendar System?

Posted: Thu May 07, 2020 12:09 pm
by RicardoMG
Hello!

This is going to be difficult and it is probably better to not try to do this. However, you can try it, you can use the following ways:
Maybe you could edit the file workflow/engine/src/ProcessMaker/Util/DateTime.php and change the functions convertTimeZone() and convertDataToTimeZone() to convert to a Jalali date.

Another option is to change the code of workflow/engine/classes/model/AppDelegation.php and workflow/engine/classes/model/Application.php files to write Persian dates to the APP_DELEGATION and APPLICATION tables. For example, you could change $this->setDelDelegateDate(...) to code to insert a Persian date.

Create a plugin that displays your own case lists in place of the Home page or create an external web page to display the case lists using REST or web services. You can replace all the datetimes with Persian dates.

Use the Custom Case List Builder to display the Persian Dates in separate columns. This is probably the easiest solution and the only one that I can recommend. To get the datetimes for a case, you can use the Cases::LoadCase(@@APPLICATION, @%INDEX) function in a trigger to get information about the the current case. See: https://wiki.processmaker.com/3.2/Cases_List_Builder

Best regards, Ricardo.