1

如何操作首先由 AnyTime Picker 生成的值?例如,我有一个带有 AnyTime 的输入字段。当我单击该字段时,它会填充当前时间,并且我希望它填充下一个小时。

4

2 回答 2

3

尝试更改anytime.js 的这些行

//  Initialize the picker's date/time value.

        try
        {
          this.time = this.conv.parse(this.inp.val());
          this.offMin = this.conv.getUtcParseOffsetCaptured();
          this.offSI = this.conv.getUtcParseOffsetSubIndex();
        }
        catch ( e )
        {
          this.time = new Date();
        }

//  Initialize the picker's date/time value.

        try
        {
          this.time = this.conv.parse(this.inp.val());
          this.offMin = this.conv.getUtcParseOffsetCaptured();
          this.offSI = this.conv.getUtcParseOffsetSubIndex();
        }
        catch ( e )
        {
          this.time = new Date();
          this.time.setHours(this.time.getHours()+1,0,0,0);
        }
于 2010-08-12T09:32:43.397 回答
1

选择器使用字段中的时间作为初始值,只有在字段无法解析时才默认为当前时间。初始化选取器的最简单方法是用您想要的起始值填充该字段,并确保它的格式正确。

于 2011-03-14T10:36:34.600 回答