JavaScript Methods not working

I have the following code:

var RetentionDate = new Date();

RetentionDate.setFullYear(startYear);

RetentionDate.setMonth(startMonth);

RetentionDate.setDate(startDay);

My client is a browser (IE and Firefox). This code works in one database when served up to the browser. In another database that I copied and pasted the code into, the setFullYear method fails. I can use setYear, it works, but that is deprecated. setMonth and setDate also fail in one db while working in another. The get methods also fail even though I can confirm that a valid date object is created and some methods work.

Is there some strange setting I’m missing?