feat(后台): 日期筛选统一默认当天(7 页 + 告警铃铛),并带上看板列改造的在途改动
- utils/datetime 新增 todayDateInput()/todayDateTimeRange(),8 处日期筛选的初值与「重置」都锁当天; 撞款监控按口径排除(该页日期是 ASIN 上架时间,默认当天会让首屏几乎为空)。 - NotificationBell 的 hasFilter 不再把日期计入:日期恒有值是默认视图,计入会让 「无筛选才记录已提醒 id」那条分支永久失效。 - 新增护栏 tests/date-filter-default-today.test.ts(6 例,变异自证 3/3 转红): 凡带日期控件的页面没接入当天默认就红,不等人工发现首屏是空的。 - 同批带上另一路会话的看板在途改动(task-center-model 的 tabCount/完成数口径、 TaskCenterBoardPage 列改造与对应用例):它与本页的日期默认改动落在同一文件, 拆开会让单次提交编译不过,故按现状一起上。
This commit is contained in:
@@ -34,6 +34,17 @@ function pad(n: string | number): string {
|
||||
return String(n).padStart(2, '0')
|
||||
}
|
||||
|
||||
/** 后台日期筛选的统一默认值:进入页面即锁定「当天」。 */
|
||||
export function todayDateInput(now: Date = new Date()): string {
|
||||
return `${now.getFullYear()}-${pad(now.getMonth() + 1)}-${pad(now.getDate())}`
|
||||
}
|
||||
|
||||
/** 当天区间(原生 <input type="datetime-local"> 取值形态,止于 23:59 与手工选择口径一致)。 */
|
||||
export function todayDateTimeRange(now: Date = new Date()): [string, string] {
|
||||
const day = todayDateInput(now)
|
||||
return [`${day}T00:00`, `${day}T23:59`]
|
||||
}
|
||||
|
||||
function padDate(d: Date): string {
|
||||
const y = d.getFullYear()
|
||||
const mo = pad(d.getMonth() + 1)
|
||||
|
||||
Reference in New Issue
Block a user