AddMonth function used to aggregate 1 months in AJO helper function | Community
Skip to main content
Level 4
February 13, 2025
Solved

AddMonth function used to aggregate 1 months in AJO helper function

  • February 13, 2025
  • 1 reply
  • 1041 views

Hi,

 

I am using it:

{%= addMonths(profile._deloittellpcanada.abnMemberDetails.tsExpect_date, 1) %}

simply want to add 1 month to tsExpect_date but action failed because of it.

 

the expect_date format is as 2024-12-04T00:00:00Z. 

 

can you help me out to troubleshoot it?

 

Thank you.

Best answer by Mohan_Dugganab

 


There is a runtime rendering error, kindly log a support ticket for this

1 reply

DavidKangni
Community Advisor
Community Advisor
February 13, 2025

@chrisyan 

Try this

Input: {%= addMonths(stringToDate("2024-12-04T00:00:00Z"),1) %}
Validation: {%= addMonths(toDateTimeOnly(profile._deloittellpcanada.abnMemberDetails.tsExpect_date,),1) %}

 

Thanks,

David

David Kangni
chrisyanAuthor
Level 4
February 13, 2025

no luck here, by the way my date is already defined as datetime with format as 2024-12-04T00:00:00Z why to use ToDatetimeOnly function

DavidKangni
Community Advisor
Community Advisor
February 13, 2025

@chrisyan 

 

I tested again and it's working for me.

by the way my date is already defined as datetime with format as 2024-12-04T00:00:00Z why to use ToDatetimeOnly function? -->

Personalization in AJO is based on the templating syntax called Handlebars. Handlebars.js treats all values as strings by default because it doesn’t have built-in type awareness like JavaScript. This means that even numbers, booleans, or objects will be coerced into strings when rendered in a template. Hence you need to convert it when using helper functions

 

Thanks,

David

David Kangni