• antd 之TimePicker设置禁用时间


    1. startTime: '00:00:00',
    2. endTime: '23:59:59'
    //现在时间以后的禁用
    getDisabledHours=()=> {
    let HOURS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
    var myDate = new Date();
    // myDate.getHours(); //获取当前小时数(0-23)
    // myDate.getMinutes(); //获取当前分钟数(0-59)
    let hours = []
    let HOURSDate=[];
    // let time = this.startTime
    let timeArr = [myDate.getHours(),myDate.getMinutes()]
    // let timeArr = time.split(':')
    for (var i = 0; i < parseInt(timeArr[0]); i++) {
    console.log('hoursiiiiiiiiii', HOURS, i, HOURS.indexOf(i));
    hours.push(i)
    }
    for ( var i = 0; i < HOURS.length; i++) {
    if (hours.indexOf(i) < 0) {
    HOURSDate.push(i)
    }
    }
    return HOURSDate
    }
    getDisabledMinutes=(selectedHour)=> {
    var MINITES = []
    for(var i = 0;i<60;i++){
    MINITES.push(i)
    }
    var myDate = new Date();
    // myDate.getHours(); //获取当前小时数(0-23)
    // myDate.getMinutes(); //获取当前分钟数(0-59)
    let timeArr = [myDate.getHours(), myDate.getMinutes()]
    let minutes = []
    let MINITESDATE=[]
    if (selectedHour == parseInt(timeArr[0])) {
    for (var i = 0; i < parseInt(timeArr[1]); i++) {
    minutes.push(i)
    }
    }
    for(var i = 0;i<MINITES.length;i++){
    if (minutes.indexOf(i) < 0) {
    MINITESDATE.push(i)
    }
    }
    return MINITESDATE
    }
    //现在时间以前的禁用
     

    getDisabledHours () {
    let hours = []
    let time = this.startTime
    let timeArr = time.split(':')
    for (var i = 0; i < parseInt(timeArr[0]); i++) {
    hours.push(i)
    }
    return hours
    },
    getDisabledMinutes (selectedHour) {
    let time = this.startTime
    let timeArr = time.split(':')
    let minutes = []
    if (selectedHour == parseInt(timeArr[0])) {
    for(var i = 0; i < parseInt(timeArr[1]); i++) {
    minutes.push(i)
    }
    }
    return minutes
    },

    getDisabledSeconds (selectedHour, selectedMinute) {
    let time = this.startTime
    let timeArr = time.split(':')
    let second = []
    if (selectedHour == parseInt(timeArr[0]) && selectedMinute == parseInt(timeArr[1])) {
    for(var i = 0; i <= parseInt(timeArr[2]); i++) {
    second.push(i)
    }
    }
    return second
    }

  • 相关阅读:
    SQL SERVER常用函数
    SQL SERVER系统表
    How do I implement a cancelable event?
    sql之left join、right join、inner join的区别
    inno setup脚本,涵盖了自定义安装界面,调用dll等等应用
    MS SQL SERVER 数据库日志压缩方法与代码
    SQLSERVER:计算数据库中各个表的数据量和每行记录所占用空间
    mysql记录执行的SQL语句
    powershell 激活WIN10
    jfinal undertow web.xml
  • 原文地址:https://www.cnblogs.com/spy66/p/12098576.html
Copyright © 2020-2023  润新知