[英]Using Dynarch's JSCalendar 1.0, how do I set the default date to yesterday
I am using JSCalendar, version 1.0, from dynarch.com I have 3 calendars on the page, and for one of them, I need to make the default date set as yesterday. 我正在使用dynarch.com的JSCalendar 1.0版,页面上有3个日历,对于其中一个日历,我需要将默认日期设置为昨天。
The code that I use to set up the calendar looks like this: 我用来设置日历的代码如下所示:
Calendar.setup({
inputField : "endDate", // ID of the input field
ifFormat : "%Y%m%d", // the date format
button : "calendarTriggerEndDate", // ID of the button
timeFormat : 24,
showsTime :false,
displayArea :"reportEndDate",
daFormat : "%b %d, %Y"
});
I have tried adding a "date" parameter, but it doesn't seem to do the job. 我尝试添加“日期”参数,但似乎没有完成这项工作。 Perhaps, it could need to be formatted differently.
也许,可能需要采用不同的格式。
How do I set the default date? 如何设置默认日期?
Unfortunately I haven't found a "clean" method to do this either, so this is how I've had to resort to a manual fix for this problem: 不幸的是,我也没有找到一种“干净”的方法来做到这一点,所以这就是我不得不依靠手工修复此问题的方式:
<input type="text" name="StartDate" id="StartDate" />
<script type="text/javascript">
var cTime = new Date();
var defDate = cTime.toISOString();
defDate = defDate.substring(0, defDate.indexOf("T"));
document.getElementById('StartDate').value = defDate;
document.write('<img src="icon.png" id="trigger" align="Cal" height="20" style="vertical-align:middle" />');
var c = Calendar.setup( {
inputField : "StartDate",
ifFormat : "%Y-%m-%d",
button : "trigger"
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.