🐞 fix(guild): 修复周一加入无活人军团领奖励问题

This commit is contained in:
dingchaolin
2023-03-03 17:02:17 +08:00
parent b66fa43039
commit 968bfc56dc
4 changed files with 39 additions and 10 deletions

View File

@@ -570,6 +570,22 @@ export function getFutureTime() {
return moment('2100-01-01').unix();
}
/**
* 判断是不是今天
* 不是标准的0点-24点时间区间是: 今天5点-明天5点
*
* @export
* @param {number} time 单位:秒
* @return {*} {Boolean}
*/
export function isToday(time: number): Boolean {
return moment().format('YYYYMMDD') === moment(time * 1000).format('YYYYMMDD');
// 今天5点
const startSeconds = getSeconds(getZeroPointD());
// 明天5点
const endSeconds = startSeconds + DAY_TO_SECOND;
if ((time > startSeconds) && (time < endSeconds)) {
return true;
}
return false;
}