Commit e75ff1a0 authored by duanjinfei's avatar duanjinfei

fix function

parent b7d9c775
...@@ -38,15 +38,12 @@ const getTimestampForMidnight3AM = () => { ...@@ -38,15 +38,12 @@ const getTimestampForMidnight3AM = () => {
// 获取当前时间 // 获取当前时间
const now = new Date(); const now = new Date();
// 将当前时间转换为东八区时间 // 设置为当天凌晨3点
const utc8Time = new Date(now.toLocaleString("en-US", { timeZone: "Asia/Shanghai" })); const threeAM = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 3, 0, 0);
// 设置时间为东八区凌晨3点 // 返回时间戳(单位:秒)
utc8Time.setHours(3, 0, 0, 0); return Math.floor(threeAM.getTime() / 1000);
};
// 返回东八区凌晨三点的时间戳(单位:秒)
return Math.floor(utc8Time.getTime() / 1000);
}
Deno.serve(async (req) => { Deno.serve(async (req) => {
if (req.method === 'OPTIONS') { if (req.method === 'OPTIONS') {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment