大佬教程收集整理的这篇文章主要介绍了ios – Mobile Safari(10.3.1)DateTime-Local“输入有效值”错误,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
这是原始HTML,附带的是检查视图和移动设备(iPhone 7)的视图.
IOS要求在输入字段上设置值,其类型为“datetiR_4_11845@e-local”.
示例:< input type =“datetiR_4_11845@e-local”value =“2000-07-01T12:00”/>
而已 :)
我个人觉得将默认值设置为用户当前本地时间很好.这必须在没有秒的情况下在ISOTime中格式化,因此这可能是这样的代码:
// get the iso time String formatted for usage in an input['type="datetiR_4_11845@e-local"'] var tzoffset = (new Date()).getTimezoneOffset() * 60000; //offset in milliseconds var localISOTime = (new Date(Date.Now() - tzoffset)).toISOString().slice(0,-1); var localISOTimeWithoutSeconds = localISOTime.slice(0,16); // SELEct the "datetiR_4_11845@e-local" input to set the default value on var dtlInput = document.querySELEctor('input[type="datetiR_4_11845@e-local"]'); // set it and forget it ;) dtlInput.value = localISOTime.slice(0,16);
以上是大佬教程为你收集整理的ios – Mobile Safari(10.3.1)DateTime-Local“输入有效值”错误全部内容,希望文章能够帮你解决ios – Mobile Safari(10.3.1)DateTime-Local“输入有效值”错误所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。