我想在 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?
答案 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
,最短可能时间为timepicker
或00:00
,最长可能时间为12:00am
或23:59
。
在您的情况下,您已11:59pm
为minTime
而10:00am
为maxTime
。如果您没有考虑在12:00am
和minTime
之间进行更改的可能性,则maxTime
大于minTime
,这是失败的原因。< / p>
只要maxTime
小于timepicker
,此minTime
就会有效。