如何在jquery时间选择器中设置最长时间为凌晨12:00

时间:2018-01-20 10:10:28

标签: javascript jquery

我想在 jQuery time picker 中将最长时间设置为凌晨12:00,但它无效。我使用以下代码:

$('#time1').timepicker({
        timeFormat: 'h:mm p',
        interval: 15,
        minTime: '10',
        maxTime: '12:00am',
        defaultTime: '10',
        startTime: '10:00',
        dynamic: false,
        dropdown: true,
        scrollbar: true
    })

但它接受11:59pm。那么如何将最长时间设置为凌晨12:00?

1 个答案:

答案 0 :(得分:0)

select cast(ShitStartTime as date) ShiftDate, ShitStartTime, ShiftEndTime , concat(right(concat('0', tTime/60), 2), ':', right(concat('0',tTime%60), 2)) Total_Time , concat(right(concat('0', onF/60), 2), ':', right(concat('0',onF%60), 2)) OnFloor , concat(right(concat('0', offF/60), 2), ':', right(concat('0',offF%60), 2)) OffFloor , [Emp Id], Incount, OutCount, Tailgate from ( select [Emp Id], min(Time) ShitStartTime, max(Time) ShiftEndTime, sum(iif([Area Of Access] = 'K4F White Rm IN', diff, 0)) onF , sum(iif([Area Of Access] = 'K4FWhite Rm OUT', diff, 0)) offF, sum(diff) tTime , sum(iif([Area Of Access] = 'K4F White Rm IN', 1, 0)) Incount , sum(iif([Area Of Access] = 'K4FWhite Rm OUT', 1, 0)) OutCount , max(Tailgate) Tailgate from ( select *, datediff(mi, Time, lead(Time) over (partition by [Emp Id], group_ order by Time)) diff , iif(Time = max(Time) over (partition by [Emp Id], group_) and [Area Of Access] = 'K4F White Rm IN', 1, 0) Tailgate from ( select *, sum(gr) over (partition by [Emp Id] order by Time rows unbounded preceding) group_ from ( select *, iif(datediff(hh, lag(Time) over (partition by [Emp Id] order by Time), Time) <= 5, 0, 1) gr from emplogindetails ) t ) t ) t group by [Emp Id], group_ ) t 未考虑当天的变化。因此,根据此timepicker,最短可能时间为timepicker00:00,最长可能时间为12:00am23:59

在您的情况下,您已11:59pmminTime10:00ammaxTime。如果您没有考虑在12:00amminTime之间进行更改的可能性,则maxTime大于minTime,这是失败的原因。< / p>

只要maxTime小于timepicker,此minTime就会有效。