情况就是这样。
我的代码在浏览器中运行,但它在After Effects中不起作用。在AE中,它返回 undefined。帮助! (运行After Effects 14.2.1.34)
var today, day, date, month
today = new Date(Date(0));
day = today.getDay();
date = today.getDate();
month = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
function printDate() {
return month[today.getMonth()] + " " + date + ", " + today.getFullYear();
}
function forceWednesday() {
if (day === 3) {
printDate();
} else if (day < 3) {
var x = day;
x = 3 - day;
return month[today.getMonth()] + " " + (date + x) + ", " + today.getFullYear();
} else if (day > 3) {
var dayDiff, dateDiff, nextWed, newDate, wed
dayDiff = day - 3;
dateDiff = date - dayDiff;
nextWed = today.setDate(dateDiff + 7);
newDate = new Date(nextWed);
wed = newDate.getDate();
return month[newDate.getMonth()] + " " + wed + ", " + newDate.getFullYear();
}
}
forceWednesday();