mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-08-21 04:09:39 +08:00
add util.ts for sharing common functions between frontend and backend
This commit is contained in:
@@ -5,19 +5,6 @@ import utc from "dayjs/plugin/utc";
|
||||
dayjs.extend(utc)
|
||||
dayjs.extend(timezone)
|
||||
|
||||
export function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
export function ucfirst(str) {
|
||||
if (! str) {
|
||||
return str;
|
||||
}
|
||||
|
||||
const firstLetter = str.substr(0, 1);
|
||||
return firstLetter.toUpperCase() + str.substr(1);
|
||||
}
|
||||
|
||||
function getTimezoneOffset(timeZone) {
|
||||
const now = new Date();
|
||||
const tzString = now.toLocaleString("en-US", {
|
||||
|
Reference in New Issue
Block a user