Is there an issue with dates?

I have a web script, that uses a NodeJS “model” class defined with:

function MemberMain(args)
{
args = args || {};
this.___class = “MemberMain”;
this.objectId = args.objectId || undefined;
this.created = args.created || null;
this.updated = args.updated || null;
this.joinDate = args.joinDate || null;
}

module.exports = MemberMain;

In the “database”, joinDate is defined as “DATETIME”

Why I retrieve this object and wrap it in the type, e.g.

var mm = new MemberMain(result from find);

joinDate comes back as “”, not null as it does with the built in properties “created” and “updated”, e.g.

{___class: "MemberMain"objectId: "BBC1FB0B-B2CC-6FC6-FF4F-A65B906E2500"created: 1439329348000updated: nulljoinDate: ""userId: "u1"shares: 1points: 250}

When I update the object, then try and save it, I get an error.

Could you please also add a screenshot of your data table and the part of code, where you do “find” query?

The txt file is an extract of the code.
The png is the table.

membermain.txt (1.41kB)

What does “MemberMain” class look like?

There is no value for the joinDate column in the table in the screenshot. What seems to be the problem?

There is one row in the screenshot.

MemberMain was shown earlier, here it is again with full properties:

function MemberMain(args)
{
	args = args || {};
	this.___class = "MemberMain";
	this.objectId = args.objectId || undefined;
	this.created = args.created || null;
	this.updated = args.updated || null;
	this.joinDate = args.joinDate || null;
	this.points = args.points || 0.0;
}

In which way do you fill the rows in your MemberMain table? Are you sure your datetime column is really null?

I will do further testing later and get back to you. Thanks for your help.

The reason I ask is that I tried to reproduce your problem and failed: I got null instead of empty string.
I suspect the problem is in the way you save your table entries. Maybe, your column is created dynamically, and you’ve saved an empty string into it in some way.
Anyway, we need some more information about how you run into this problem in order to reproduce it.

Hi,

I did some further examination and realized I had a legacy file that contained another version of the MemberMain function, which was overriding the one I sent you. It contained a different initialization of joinDate, i.e. :

this.joinDate = args.joinDate || "";

Thanks for your help, and sorry to waste your time.

Regards
Paul