IT2BE Tools - dateFormat

I have a solution which contains a module. In one of my calculations in the referenced module I get the following error:

Exception executing calculation: mbrship_validity_display of table obj_mbrship, error: org.mozilla.javascript.EvaluatorException: The choice of Java constructor js_dateFormat matching JavaScript argument types (null,string) is ambiguous; candidate constructors are:
class java.lang.String js_dateFormat(java.lang.Object,java.lang.String)
class java.util.Date js_dateFormat(java.lang.String,java.lang.String) (/Users/tsr/servoy_workspace/Output/datasources/dca_db/obj_mbrship/obj_mbrship_calculations.js#27)

org.mozilla.javascript.EvaluatorException: The choice of Java constructor js_dateFormat matching JavaScript argument types (null,string) is ambiguous; candidate constructors are:
class java.lang.String js_dateFormat(java.lang.Object,java.lang.String)
class java.util.Date js_dateFormat(java.lang.String,java.lang.String) (/Users/tsr/servoy_workspace/Output/datasources/dca_db/obj_mbrship/obj_mbrship_calculations.js#27)

If I’m in the main solution, I don’t get the error, if I’m in the referenced solution (Output) I do get it. However, the calculation executes and returns the correct string in both solutions.

function mbrship_validity_display()
{
	return  "Gültig von " + plugins.it2be_tools.dateFormat(valid_from, 'dd.MM.yyyy') + " bis "  + plugins.it2be_tools.dateFormat(valid_to, 'dd.MM.yyyy');
}

Why do I get the message in the “Problems” tab?

Thanks,
Reto

Hi reto,

If you have issues with third party plugins/beans you should ask your questions about that in their support systems.
So for this plugin you can go to http://www.it2be.com/index.php/support/ .

But looking at your code it seems to me you can simply use the built-in utils.dateFormat() function from Servoy.

Hope this helps.

xtsr:
Why do I get the message in the “Problems” tab?

beside the question ‘why’ which would be an interesting answer anyway: Can’t you just use the standard ‘utils.dateFormat’ function?

utils.dateFormat(date, format)

This should have a simular result I guess, without the need of using extra plugin. (I know you probably will use it for other things as well, but still… :) )