Currently using CiviCRM Version 5.31 (Wordpress Version 5.5.3)

Installed the extension to change Activities Duration from Minutes to Hours


The extension works for Contact Activities but not Case Activities.

enter image description here

enter image description here

Does anyone know what needs to be done to make the changes in Case Activities ?


Hi Demerit, thank you for the prompt response.

I changed the lines in both activityhours.php and activityhours.js but the duration for case activities are still in 'minutes'.

Please advise

enter image description here

enter image description here

1 Answer 1


You could try changing this line in activityhours.php from:

if ($formName == 'CRM_Activity_Form_Activity' && !CRM_Utils_Request::retrieveValue('snippet', 'String')) {


if (($formName == 'CRM_Activity_Form_Activity' || $formName == 'CRM_Case_Form_Activity') && !CRM_Utils_Request::retrieveValue('snippet', 'String')) {

You'd probably also have to add some selectors in the .js file, e.g. whereever it says .crm-activity-form-block-duration also add .crm-case-activity-form-block-duration

You could post a feature request at https://lab.civicrm.org/extensions/activityhours/-/issues, but if you're able to also post a merge request with some tested code changes that would be best.

  • Hi Demerit, thank you for the prompt response. I have changed the lines based on your advice but the duration is still in minutes (Please see above). Please
    – TIAPL
    Commented Feb 6, 2021 at 5:13
  • I was giving general instructions but you're going to have to investigate further and find the right things to add. The javascript I mentioned is just for viewing not editing but note you would need to add a selector as an additional target not insert the class into the existing target. For editing just the line in activityhours.php should work but note that on a New Case it's a different form so you would need to make additional adjustments specific to Open Case. It will take some trial and error.
    – Demerit
    Commented Feb 6, 2021 at 14:18
  • My apologies: not being a coder & with English being a second language. I hope for a more layman explanation/ instructions
    – TIAPL
    Commented Feb 7, 2021 at 12:46
  • No need to apologize it's just to add a feature like this and work out the details and test it etc someone will have to put in some time and effort.
    – Demerit
    Commented Feb 7, 2021 at 16:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.