Expand my Community achievements bar.

Attention: Experience League Community will undergo scheduled maintenance on Tuesday, August 20th between 10-11 PM PDT. During this time, the Community and its content will not be accessible. We apologize for any inconvenience this may cause.

Javascript Date() function not working

Avatar

Former Community Member
Hi,



I'm experiencing some problems with the Date() function in javascript. The problem is that the function doesn't seem to work. For example when I do "var date = new Date(); xfa.host.messageBox(date);" in the enter event of a date field, I get "Date is not a function" error message in de javascript debugger.



Is there anyone out there who knows how why the Date function is not working in LiveCycle Designer. Am I using the Date function in an improper way or maybe I am using the wrong function?



Please can anyone help me out?
3 Replies

Avatar

Former Community Member
Just tried it and it worked for me .... I noticed that if I use



xfa.host.messageBox(date);



I go a blank message but if I used



app.alert(date);



then it worked fine.

Avatar

Former Community Member
Just played a bit more ...it looks like the xfa.host.messageBox doesn't try to set the object as a string like app.alert does. If you change it to a string it works fine. Try this:



xfa.host.messageBox(date.toString());

Avatar

Former Community Member
Hi Paul,



Thanx for you reply. It worked fine.



I also found out that following works as well:



var MyDate = util.scand("dd-mm-yyyy",new Date());

console.println("this date: "+util.printd("dd-mm-yyyy", MyDate));