From 0c689286ad795b39d396ed2726b8cc572e62b166 Mon Sep 17 00:00:00 2001 From: liyi Date: Fri, 7 Mar 2025 11:15:19 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=A2=9E=E5=8A=A0=E6=97=B6=E5=88=86?= =?UTF-8?q?=E5=AD=97=E7=AC=A6=E4=B8=B2=E8=BD=AC=E4=BA=8C=E8=BF=9B=E5=88=B6?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- format.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/format.js b/format.js index 008ca87..051e0b7 100644 --- a/format.js +++ b/format.js @@ -26,6 +26,18 @@ export function timestampToArray(timestamp) { array[3] = timestamp & 0xff return array } +// 时分字符串转二进制 +export function parseTimeToList(timeString) { + let timeList = [0, 0, 0, 0] + + if (timeString.includes(':')) { + let timeParts = timeString.split(':') + timeList[2] = parseInt(timeParts[0], 10) + timeList[3] = parseInt(timeParts[1], 10) + } + + return new Uint8Array(timeList) +} // md5加密 export function md5Encrypt(text, token, key) {