首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >关于在WPForms中限制天数的脚本

关于在WPForms中限制天数的脚本
EN

Stack Overflow用户
提问于 2022-02-03 19:50:50
回答 1查看 63关注 0票数 0

从今天开始,我试着从第八天开始选择,但是无法做到,时间就要结束了。

也许有人能为我的代码指出正确的方向?

代码语言:javascript
复制
<script>
 
      // Find out the current time
      var now = new Date();
 
      // Take that current time and round it up so we have an even number on the interval
      now.setHours( now.getHours() + Math.round(date.getMinutes()/90) );
        
      window.wpforms_999_8 = window.wpforms_999_8 || {};
      window.wpforms_999_8.timepicker = {
         forceRoundTime: true,
 
         // Disable any times that have passed already and return the new time selections
         minTime: now+8.toLocaleTimeString()
      };
      
      new customDatePicker();
} );
</script>
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-02-03 20:07:12

这就像一种魅力:

代码语言:javascript
复制
function wpf_dev_limit_date_picker() {
?>
<script type="text/javascript">
    window.wpforms_3017_9 = window.wpforms_3017_9 || {};
    window.wpforms_3017_9.datepicker = {
        disableMobile: true,
        // Don't allow users to pick before 8th day from today
        minDate: new Date().fp_incr(+8),
        }
</script>
<?php
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70977422

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档