var date = new Date();
var format = new java.text.SimpleDateFormat();
var d = format.format(date);
which throws
org.mozilla.javascript.EvaluatorException: Cannot convert
org.mozilla.javascript.NativeDate@299a21 to java.util.Date
in NativeJavaObject.coerceType(NativeJavaObject.java:685).
I know I could use java.util.Date directly, but I already have the
native date object and would prefer not to create another date object
just for formatting.
It seems this is easy to fix by adding a case in
NativeJavaObject.coerceType and a method that returns the time in
milliseconds in NativeDate, but before making a patch I wanted to
reassure myself whether this would be accepted by the maintainers or
whether I'm overlooking something and there's a reason for there not to
be automatic coercion (standards, different semantics...).
Hannes