我的项目中有一个奇怪的问题。我正在尝试将参数动态插入到 Date 对象构造函数中。这是我的代码:
from += fromYear + "," + fromMonth + "," + fromDay + "," + fromHour + "," + fromMinute;
to += toYear + "," + toMonth + "," + toDay + "," + toHour + "," + toMinute;
console.log(from); //here is log value: 2012,8,25,9,22
console.log(to); //another log: 2012,8,25,9,52
//Creating object
var fromtime = new Date(from);
var totime = new Date(to);
当我试图提醒日期对象(totime 或 fromtime)时,出现错误:Invalid Date。我不知道如何通过它。你可以帮帮我吗?
我试过这个: 创建日期对象 JS