简体   繁体   English

DatePicker默认为今天

[英]DatePicker Default to Today

I know this is probably very simple, but what I'm trying isn't working. 我知道这可能很简单,但我正在尝试的是不行。 I'm just trying to get my Date Picker on my XPage to default to today's date. 我只是想把我的日期选择器放在我的XPage上,默认为今天的日期。 I've tried the following: 我尝试过以下方法:

var dt:NotesDateTime= session.createDateTime("Today"); dt.setNow();

and

session.evaluate("@Today")

and

var doc:NotesDocument = currentDocument.getDocument();
var dt:NotesDateTime = doc.getCreated();
dt.setAnyTime();
return dt.getLocalTime();

No matter what I try, the Date Picker is unchanged. 无论我尝试什么,日期选择器都没有改变。

The following is an example of setting today's date as the default value for a date field (for which a date picker has been attached): 以下是将今天的日期设置为日期字段(已为其附加日期选择器)的默认值的示例:

<xp:inputText id="Date" value="#{document.date}" defaultValue="#{javascript:@Today()}">
    <xp:dateTimeHelper id="dateTimeHelper1" />
</xp:inputText>

Please notice that IBM Domino 9.0 had a bug where all date fields had today's date as the default value. 请注意,IBM Domino 9.0存在一个错误,其中所有日期字段都将今天的日期作为默认值。 You should upgrade to 9.0.1 (or use the workaround: https://stackoverflow.com/a/15780768/785061 ). 您应该升级到9.0.1(或使用解决方法: https//stackoverflow.com/a/15780768/785061 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM