cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Nintex Newbie

JavaScript Concatenation

Jump to solution

Hi Folks,

I am tinkering around in our new Nintex Forms subscription and I was trying to concatenate some date parts to generate a date format. All of my function works except for one line (the 7th line with concat method). I am not a JS expert but this seems like the correct syntax. Can anyone tell me where I went wrong?

Also, is there a better way to represent code blocks in forum posts?

function loadStrDate(){
    var curDate = new Date();
    var curMonth = curDate.getMonth();
    var curDte = curDate.getDate();
    var curMSYear = curDate.getYear();
    var curYear = curMSYear + 1900;
    var strDate = curMonth.cancat("/",curDte,"/",curYear);
    NWF$('#'+ jsvar_strDate).val(strDate);
};

Thanks and regards,

Patrick Kelligan

0 Kudos
Reply
7 Replies
Highlighted
Automation Master
Automation Master

Re: JavaScript Concatenation

Jump to solution

try this

function loadStrDate(){
    var curDate = new Date();
    var curMonth = curDate.getMonth();
    var curDte = curDate.getDate();
    //var curMSYear = curDate.getYear();
    //var curYear = curMSYear + 1900;
    var curYear = curDate.getFullYear();
    var strDate = String(curMonth).concat("/",curDte,"/",curYear);
    NWF$('#'+ jsvar_strDate).val(strDate);
};

View solution in original post

Reply
Highlighted
Nintex Newbie

Re: JavaScript Concatenation

Jump to solution

That  did it! Thanks Marian!

How did you get the code block formatted like it is?

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: JavaScript Concatenation

Jump to solution

Reply
Highlighted
Nintex Newbie

Re: JavaScript Concatenation

Jump to solution

Thanks Marian!

0 Kudos
Reply
Highlighted
Automation Master
Automation Master

Re: JavaScript Concatenation

Jump to solution
function loadStrDate(){
    var curDate = new Date();
    NWF$('#'+ jsvar_strDate).val((curDate.getMonth() + 1) + '/' + curDate.getDate() + '/' + curDate.getFullYear());
};‍‍‍‍‍‍‍‍
Reply
Highlighted
Automation Master
Automation Master

Re: JavaScript Concatenation

Jump to solution

make sure you do the getMonth + 1 because its return value is from 0 to 11

Reply
Highlighted
Nintex Newbie

Re: JavaScript Concatenation

Jump to solution

Hi Andrew,

I incorporated your changes and it is much cleaner. Thanks for "+ 1" tip on the month!

Thanks and Regards,

Patrick

Reply