Hi,
I added a method to calculate a date for some expression type fields like below:
JavaScriptexport function addDays(params: any) {
if (!Array.isArray(params) || params.length !== 2 || !params[0]) return '';
const date = new Date(params[0]);
const daysToAdd = Number(params[1]);
const calculatedDate = dayjs(date)
.add(daysToAdd, 'days')
.format('MM/DD/YYYY');
return calculatedDate;
}
However when I try to register it like below(im showing some other stuff registered as well), it throws a maximum update depth reached error:
JavaScriptSurveyCore.StylesManager.applyTheme('defaultV2');
SurveyReactUI.ReactQuestionFactory.Instance.registerQuestion(
'sv-tagbox-react',
(props: any) => {
return React.createElement(MultiSelect, props);
},
);
SurveyCore.RendererFactory.Instance.registerRenderer(
'checkbox',
'tagbox-react',
'sv-tagbox-react',
);
//THIS IS THE LINE OF THE ERROR
SurveyCore.FunctionFactory.Instance.register('addDays', addDays);
// ... Survey component rendering code
Not sure why it is related to that since it works on a sandbox sample but not in my project.
Also when I have the same function addDays as exported from an outside file it throws some error but not when I have it on the same file.
Any guidance would be appreciated.