From 6a6a58c94497cc008ca467942f99576e1385d9ad Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 21 Sep 2022 14:41:19 +0800 Subject: [PATCH] 1 --- utils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/utils.js b/utils.js index f98385c..07b9fb4 100644 --- a/utils.js +++ b/utils.js @@ -78,6 +78,11 @@ function getDaySeconds(time, timeZone) { 3600 * timeZone; } +function getHourSeconds(time, timeZone) { + const daySeconds = getDaySeconds(time, timeZone); + return Math.floor((time - daySeconds) / 3600) * 3600; +} + function formatDate(date) { const year = date.getFullYear(); const month = date.getMonth() + 1;//月份是从0开始的 @@ -257,6 +262,7 @@ exports.isOnlineEnv = isOnlineEnv; exports.getTickCount = getTickCount; exports.getUtcTime = getUtcTime; exports.getDaySeconds = getDaySeconds; +exports.getHourSeconds = getHourSeconds; exports.formatDate = formatDate; exports.pad = pad; exports.randRange = randRange;