Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TypeError: Date is not a constructor

So, I've been making forms for my company for some time now with pretty easy Javascript that has worked for me in the past. However all of a sudden it's kicking out the error: TypeError: Date is not a constructor

The Code:

var Date = this.getField("Text1");
Date.value = util.printd("mm/dd/yyyy",new Date());

It works on all my old forms, but now it won't work on new ones... and I've tried making a new button on an old form - just copying and pasting the code, and then it'll break all the other buttons and spit out the same error.

Running: Windows 7 64-bit with Acrobat XI 11.0.10

like image 945
Pepper Ky Avatar asked May 08 '15 18:05

Pepper Ky


1 Answers

This worked for me:

  var d = new window.Date();
like image 152
garish Avatar answered Sep 16 '22 16:09

garish