java.lang.RuntimeException when using dates in objects

Hello,

I have the following code:

var vRecordOld = foundset.getRecord(1);
var vRecordNew = foundset.getRecord(2);

var vDifferentFields = new Array();
for ( var vField in vRecordOld )
{
	if (vRecordOld[vField] != vRecordNew[vField]) {
		vDifferentFields[vDifferentFields.length] = vField;
	}
}

At the point where vField is a date field, I get this error:

java.lang.RuntimeException
at org.mozilla.javascript.ScriptRuntime.eq(ScriptRuntime.java:1657)
at org.mozilla.javascript.Interpreter.do_eq(Interpreter.java:2602)
at org.mozilla.javascript.Interpreter.interpret(Interpreter.java:1649)
at org.mozilla.javascript.InterpretedFunction.call(InterpretedFunction.java:94)
at com.servoy.j2db.scripting.e.call(Unknown Source)
at com.servoy.j2db.develop.debugger.k.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k.executeFunction(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.FormPanel.a(Unknown Source)
at com.servoy.j2db.develop.debugger.k$h.actionPerformed(Unknown Source)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

I have played with this a little more and tried this code:

var vObject = new Object();
vObject.date1 = new Date();
vObject.date2 = new Date();
if (vObject.vDate1 != vObject.vDate2) {
	application.output('These dates are not the same');
}
else {
	application.output('Servoy thinks these dates are the same. Difference in ms is: ' + (vObject.date2 - vObject.date1));
}

If you debug slowly you get this output:

Servoy thinks these dates are the same. Difference in ms is: 860

Am I misunderstanding something fundamental or is this a bug?

Thanks
Patrick

One more remark: extracting the record’s fields doesn’t heal the problem.

So this code:

var vOldValue = vRecordOld[vField];
var vNewValue = vRecordNew[vField];
if (vOldValue != vNewValue)

doesn’t work either.

Could anyone help me to compare two records like this?

Thanks
Patrick