Use case

Return the number of months elapsed from a date selected in a Date Picker custom field until the current date and time. For example, if a Date Picker is selected on 20 January 2024 and the current date is 10 March 2024, the number 2 will be returned.

Expression

Create and configure a Smart field using this expression in General parsing mode:

%{{issue.cfnnnnn} != null ? ((year({system.currentDateTime}, RUN_AS_LOCAL) - year({issue.cfnnnnn}, RUN_AS_LOCAL))*12 + month({system.currentDateTime}, RUN_AS_LOCAL) - (month({issue.cfnnnnn}, RUN_AS_LOCAL))) : null} 

Please, replace both nnnnn in the above expression with the ID of your Date Picker custom field.

 Used parser functions