getDate() function not working anymore?

Hi,

Hope you guys can help me here… I run an invoicing system through wix and my business relies all on this.

Have this function to create a date in text format. Haven’t touched for almost a year and has been working fine until yesterday?

I’ve got an afterQuery calling this functions, and now if I don’t disable anythig the has a getDate() function or anything realated to date it won’t load the Collection and let me access the data?

Below are some examples that were working fine until yesterday

function createdate ( create ) {
const days = create . getDate ();
const months = create . getMonth () + 1 ;
const year = create . getFullYear ();

let createDate = days + “/” + months + “/” + year
return createDate ;

function ageFromDob ( birthday ) {
const now = new Date ();
const days = now . getDate () - birthday . getDate ();
const months = - now . getMonth () + birthday . getMonth ();
let age = now . getFullYear () - birthday . getFullYear () - months / 12 ;
return age . toFixed ( 1 );

Thanks!

Duarte

Do you still get errors?

Yes… Nothing has changed, same issue.

Anything else I can do?

You only posted part of your code. That’s enough in order to come to conclusion.

Sorry. Here’s the complete code that used to work on the backend with no issues.

export function enterContest01_afterQuery ( item , context ) {

if ( item . chineseName === undefined ) {
item . fullName = item . firstName + " " + item . playerSurname
}
else
{
item . fullName2 = item . firstName + " " + item . playerSurname + " " + item . chineseName ;
}

item . age = ageFromDob ( item . birthday );
item . createDate1 = createdate ( item . _createdDate );

item . diffDays = daystoBday ( item . birthday )
item . bdayDate1 = createdate ( item . birthday );

item . playerRefText = item . playerRef ;
return item ;

}

function ageFromDob ( birthday ) {
const now = new Date ();
const days = now . getDate () - birthday . getDate ();
const months = - now . getMonth () + birthday . getMonth ();
let age = now . getFullYear () - birthday . getFullYear () - months / 12 ;
//if (months < 0 || (months === 0 && days < 0))
{
//age–;
}

return age . toFixed ( 1 );
}

I don’t see a problem except for the {} that you forgot to comment out.
Try to add console.log() 's to locate the problem.