每天不同時間段,認領狀態判斷問題

2022-03-25 21:52:39 字數 1390 閱讀 8754

需求每天多個時間段裡可認領,在可認領時間段的倒計時一小時內,顯示倒計時;在可認領時間段內,按鈕為亮色;不在可認領時間段內,按鈕為灰色

解決:

const timesolts = res.data.data.limittime

// const timesolts = '10:40-11:00;12:00-02:00'

let obj =

if (!timesolts)

} else

//處理可認領時間段資料

handletime: async (timesolts, diff) =>

let val = ''

let beginarr =

let overarr =

if (!timearrays) else

const limitbegin = item.split('-')[0]

const limitover = item.split('-')[1]

const today = moment().format('yyyy-mm-dd')

//開搶時間

const timebegintoday = moment(today + ' ' + limitbegin).unix()

const timeovertoday = moment(today + ' ' + limitover).unix()

beginarr.push(timebegintoday - 3600)

overarr.push(timeovertoday)

//現在時間

const nowtime = moment().unix() + parseint(diff)

let handlevalue = ''

if (nowtime >= timebegintoday && nowtime < timeovertoday) else if (nowtime > timeovertoday) else if (nowtime < timebegintoday && (timebegintoday - nowtime) > 3600) else if (nowtime < timebegintoday && (timebegintoday - nowtime) <= 3600)

curarray.push(handlevalue)

})let curset = new set(curarray)

if (curset.has('canclaim')) else

}if (newarray.length === 0 && !curset.has('canclaim')) else if (newarray.length) }}

obj =

return obj

},

pandas sql不同時間段彙總小技巧

pandas sql小技巧 統計不同產品在不同時間段的銷量,即,a產品統計1 5號,b產品統計3 7號的銷量 對於這種簡單問題,首先想到的是,用sql去做,只要提取對應的時間區間就好了。sql語法如下 先取出指定日期區間的資料 先取出指定日期區間的資料 select a.id as 產品id,a.s...

jq不同時間段,更改文字的內容

下面是獲取時間日期的方法,需要什麼樣的格式自己拼接起來就好了 date.getfullyear 獲取完整的年份 4位,1970 date.getmonth 獲取月份 0 11,0代表1月,用的時候記得加上1 date.getdate 獲取日 1 31 date.gettime 獲取時間 從1970....

Oracle按不同時間分組統計

oracle按不同時間分組統計的sql 如下表table1 日期 exportdate 數量 amount 14 2月 0820 10 3月 082 14 4月 086 14 6月 0875 24 10月 0923 14 11月 0945 04 8月 105 04 9月 1044 04 10月 10...