优化页面
This commit is contained in:
10
components/DifferenceArray.js
Normal file
10
components/DifferenceArray.js
Normal file
@@ -0,0 +1,10 @@
|
||||
function DifferenceArray(targetTimestamp) {
|
||||
const now = Date.now() / 1000; // 获取当前时间戳(秒)
|
||||
|
||||
// 计算时间差(秒)并转换为小时
|
||||
const diffHours = Math.ceil((targetTimestamp - now) / 3600);
|
||||
|
||||
// 生成包含小时数的数组
|
||||
return Array.from({ length: diffHours }, (_, i) => String(i + 1));
|
||||
}
|
||||
export default DifferenceArray;
|
||||
Reference in New Issue
Block a user