How to convert string to int in jinja/macro

tried to use below max_counter as loop max number. but the result from dbt_utils.datediff is str. when using lie below will have error: ‘str’ object cannot be interpreted as an integer. but when attempted to convert str to int using {{dbt_utils.datediff(“‘2018-01-01’”, “‘2018-09-20’”, ‘month’)|int}}
the result will be 0? anyone know the reason? i just want to have result as number instead of str. why ‘8’ will become 0 after convert.
anyone can help?

{% macro SP_WARD_VILLAGE_YEARLY_SALES() %}

{% set max_counter = dbt_utils.datediff(“‘2018-01-01’”, “‘2018-09-20’”, ‘month’) %}

create or replace table semantic.test(id int);

{% for counter in range(1,max_counter ) %}

{% if counter < max_counter %}

insert into semantic.test(id)

select {{max_counter}} ;

{% endif %}

{%set counter = counter+1 %}

{% endfor %}

{% endmacro %}