refactor(仪表板): 时间字段跳转精确到秒
This commit is contained in:
parent
757e9a18b0
commit
93738ef0aa
@ -15,6 +15,8 @@ export const getRange = (selectValue, timeGranularity) => {
|
|||||||
case 'minute':
|
case 'minute':
|
||||||
case 'y_M_d_H_m':
|
case 'y_M_d_H_m':
|
||||||
return getMinuteEnd(selectValue)
|
return getMinuteEnd(selectValue)
|
||||||
|
case 'y_M_d_H_m_s':
|
||||||
|
return getSecondEnd(selectValue)
|
||||||
case 'datetime':
|
case 'datetime':
|
||||||
return [+new Date(selectValue), +new Date(selectValue)]
|
return [+new Date(selectValue), +new Date(selectValue)]
|
||||||
default:
|
default:
|
||||||
@ -63,6 +65,10 @@ const getMinuteEnd = timestamp => {
|
|||||||
return [+new Date(timestamp), +new Date(timestamp) + 60 * 1000 - 1000]
|
return [+new Date(timestamp), +new Date(timestamp) + 60 * 1000 - 1000]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getSecondEnd = timestamp => {
|
||||||
|
return [+new Date(timestamp), +new Date(timestamp) + 999]
|
||||||
|
}
|
||||||
|
|
||||||
const getYearBegin = timestamp => {
|
const getYearBegin = timestamp => {
|
||||||
const time = new Date(timestamp)
|
const time = new Date(timestamp)
|
||||||
return +new Date(time.getFullYear(), 0, 1)
|
return +new Date(time.getFullYear(), 0, 1)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user