gpt4 book ai didi

html - datetime-local步骤不适用于移动设备

转载 作者:行者123 更新时间:2023-12-03 16:27:00 25 4
gpt4 key购买 nike

<input type="datetime-local" step="1800"></input>
上面的代码行在某些手机上不起作用。我的手机上的step属性仍然为1分钟。

经过测试的手机:iPhone 6,iOS 10,带有Safari和Chrome的手机。

有什么帮助吗?

最佳答案

首先让我们解释step属性的工作方式

step属性是一个数字,用于指定值必须遵守的粒度或特殊值(任意值),如下所述。仅等于步进基础的值(如果指定,则为最小值,否则为该值;如果未提供,则为适当的默认值)。

字符串值any意味着没有步进,并且允许任何值(除非有其他限制,例如min和max)。

Note: When the data entered by the user doesn't adhere to the stepping configuration, the user agent may round to the nearest valid value, preferring numbers in the positive direction when there are two equally close options.



对于本地日期时间输入,step的值以秒为单位,缩放因子为1000(因为基础数字值以毫秒为单位)。 step的默认值为60,表示60秒(或1分钟,或60,000毫秒)。

目前,尚不清楚与datetime-local输入配合使用时,step的含义是什么。确定该信息后,将对此进行更新。

可能的解决方案

要使用此属性,我们还应该指定其他2个属性: maxmin
什么是max属性?

接受的最新日期和时间。如果输入到元素的值晚于此时间戳,则该元素将无法通过约束验证。如果max属性的值不是遵循yyyy-MM-ddThh:mm格式的有效字符串,则该元素没有最大值。

此值必须指定一个日期字符串,该日期字符串应晚于或等于min属性指定的日期字符串。

什么是min属性?

最早接受的日期和时间;如果时间戳早于此时间,则会导致元素无法通过约束验证。如果min属性的值不是遵循yyyy-MM-ddThh:mm格式的有效字符串,则该元素没有最小值。

此值必须指定一个日期字符串,该日期字符串早于或等于max属性指定的日期字符串。

最终代码
<input type="datetime-local" max="2020-06-20T20:06" min="2020-02-20T02:20" step="60"></input>

关于html - datetime-local步骤不适用于移动设备,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40280165/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com