5

I am currently trying to find the number of days between the current date and the case start date using searchkit. I have tried the "Date between two dates" function on Searchkit, however it does not allow me to choose for current date.

I have also tried the "Rewrite" function on Searchkit with the following code: {'[Contact_CaseContact_Case_01.start_date]'|smarty_modifier_datediff start_date='[CURDATE()]'} However, seems like the Smarty tokens does not work. Could anyone help me with this?

Screenshot of the Rewrite code to calculate number of days

3
  • 3
    I believe I have solve this issue. Leaving the code here in case anyone needs it in the future: {capture assign=time_in}{'[DATE_created_date]'|date_format:'%s'}{/capture} {capture assign=time_out}{'$smarty.now'|date_format:'%s'}{/capture} {math equation="ceil((y-x)/(60*60*24))" y=$time_out x=$time_in} days
    – Cas
    Commented Aug 1, 2023 at 14:38
  • 2
    Well done. if you have enough reputation you should be able to paste the above as an Answer, which then helps close off this issue.
    – petednz - fuzion
    Commented Aug 1, 2023 at 19:56
  • Yes good job sticking with it. It will work for current php versions just note smarty date_format is deprecated because it uses strftime which is deprecated in php, so will eventually stop working. There have been a few discussions as to what to do about this, in particular with search kit since it also depends on your date format prefs as to whether it can parse it properly. Example chat: chat.civicrm.org/civicrm/pl/qif3rus3sfgwjrmns4wkmhf4bo
    – Demerit
    Commented Aug 2, 2023 at 3:49

0

Your Answer

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

Browse other questions tagged or ask your own question.