mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-15 05:41:51 +00:00
feat: fix leap year rules, add year and month to the delay string
This commit is contained in:
parent
504ffd729d
commit
5c0602715d
28 changed files with 64 additions and 55 deletions
34
backend/src/humanizeDuration.ts
Normal file
34
backend/src/humanizeDuration.ts
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
import humanizeduration from "humanize-duration";
|
||||||
|
|
||||||
|
export const delayStringMultipliers = {
|
||||||
|
y: 1000 * 60 * 60 * 24 * (365 + 1 / 4 - 1 / 100 + 1 / 400),
|
||||||
|
mo: 1000 * 60 * 60* 24 * (365 + 1 / 4 - 1 / 100 + 1 / 400) / 12,
|
||||||
|
w: 1000 * 60 * 60 * 24 * 7,
|
||||||
|
d: 1000 * 60 * 60 * 24,
|
||||||
|
h: 1000 * 60 * 60,
|
||||||
|
m: 1000 * 60,
|
||||||
|
s: 1000,
|
||||||
|
x: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
export const humanizeDurationShort = humanizeduration.humanizer({
|
||||||
|
language: "shortEn",
|
||||||
|
languages: {
|
||||||
|
shortEn: {
|
||||||
|
y: () => "y",
|
||||||
|
mo: () => "mo",
|
||||||
|
w: () => "w",
|
||||||
|
d: () => "d",
|
||||||
|
h: () => "h",
|
||||||
|
m: () => "m",
|
||||||
|
s: () => "s",
|
||||||
|
ms: () => "ms",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
spacer: "",
|
||||||
|
unitMeasures: delayStringMultipliers
|
||||||
|
});
|
||||||
|
|
||||||
|
export const humanizeDuration = humanizeduration.humanizer({
|
||||||
|
unitMeasures: delayStringMultipliers
|
||||||
|
});
|
|
@ -1,18 +0,0 @@
|
||||||
import humanizeDuration from "humanize-duration";
|
|
||||||
|
|
||||||
export const humanizeDurationShort = humanizeDuration.humanizer({
|
|
||||||
language: "shortEn",
|
|
||||||
languages: {
|
|
||||||
shortEn: {
|
|
||||||
y: () => "y",
|
|
||||||
mo: () => "mo",
|
|
||||||
w: () => "w",
|
|
||||||
d: () => "d",
|
|
||||||
h: () => "h",
|
|
||||||
m: () => "m",
|
|
||||||
s: () => "s",
|
|
||||||
ms: () => "ms",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
spacer: "",
|
|
||||||
});
|
|
|
@ -1,6 +1,6 @@
|
||||||
import z from "zod";
|
import z from "zod";
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||||
import { humanizeDurationShort } from "../../../humanizeDurationShort.js";
|
import { humanizeDurationShort } from "../../../humanizeDuration.js";
|
||||||
import { getBaseUrl } from "../../../pluginUtils.js";
|
import { getBaseUrl } from "../../../pluginUtils.js";
|
||||||
import { convertDelayStringToMS, sorter, zDelayString } from "../../../utils.js";
|
import { convertDelayStringToMS, sorter, zDelayString } from "../../../utils.js";
|
||||||
import { RecentActionType } from "../constants.js";
|
import { RecentActionType } from "../constants.js";
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
TextInputBuilder,
|
TextInputBuilder,
|
||||||
TextInputStyle,
|
TextInputStyle,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { logger } from "../../../logger.js";
|
import { logger } from "../../../logger.js";
|
||||||
import { canActOn } from "../../../pluginUtils.js";
|
import { canActOn } from "../../../pluginUtils.js";
|
||||||
|
|
|
@ -7,7 +7,7 @@ import {
|
||||||
TextInputBuilder,
|
TextInputBuilder,
|
||||||
TextInputStyle,
|
TextInputStyle,
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
||||||
import { logger } from "../../../logger.js";
|
import { logger } from "../../../logger.js";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||||
import { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop.js";
|
import { registerExpiringVCAlert } from "../../../data/loops/expiringVCAlertsLoop.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { GuildMember } from "discord.js";
|
import { GuildMember } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { LogType } from "../../../data/LogType.js";
|
import { LogType } from "../../../data/LogType.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Attachment, ChatInputCommandInteraction, GuildMember, Message, User } from "discord.js";
|
import { Attachment, ChatInputCommandInteraction, GuildMember, Message, User } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { getMemberLevel } from "knub/helpers";
|
import { getMemberLevel } from "knub/helpers";
|
||||||
import { CaseTypes } from "../../../../data/CaseTypes.js";
|
import { CaseTypes } from "../../../../data/CaseTypes.js";
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { Attachment, ChatInputCommandInteraction, GuildMember, Message, Snowflak
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { CaseTypes } from "../../../../data/CaseTypes.js";
|
import { CaseTypes } from "../../../../data/CaseTypes.js";
|
||||||
import { LogType } from "../../../../data/LogType.js";
|
import { LogType } from "../../../../data/LogType.js";
|
||||||
import { humanizeDurationShort } from "../../../../humanizeDurationShort.js";
|
import { humanizeDurationShort } from "../../../../humanizeDuration.js";
|
||||||
import { canActOn, getContextChannel, isContextInteraction, sendContextResponse } from "../../../../pluginUtils.js";
|
import { canActOn, getContextChannel, isContextInteraction, sendContextResponse } from "../../../../pluginUtils.js";
|
||||||
import { DAYS, MINUTES, SECONDS, noop } from "../../../../utils.js";
|
import { DAYS, MINUTES, SECONDS, noop } from "../../../../utils.js";
|
||||||
import { CasesPlugin } from "../../../Cases/CasesPlugin.js";
|
import { CasesPlugin } from "../../../Cases/CasesPlugin.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Attachment, ChatInputCommandInteraction, GuildMember, Message, User } from "discord.js";
|
import { Attachment, ChatInputCommandInteraction, GuildMember, Message, User } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { ERRORS, RecoverablePluginError } from "../../../../RecoverablePluginError.js";
|
import { ERRORS, RecoverablePluginError } from "../../../../RecoverablePluginError.js";
|
||||||
import { logger } from "../../../../logger.js";
|
import { logger } from "../../../../logger.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Attachment, ChatInputCommandInteraction, GuildMember, Message, User } from "discord.js";
|
import { Attachment, ChatInputCommandInteraction, GuildMember, Message, User } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { UnknownUser, asSingleLine, renderUsername } from "../../../../utils.js";
|
import { UnknownUser, asSingleLine, renderUsername } from "../../../../utils.js";
|
||||||
import { MutesPlugin } from "../../../Mutes/MutesPlugin.js";
|
import { MutesPlugin } from "../../../Mutes/MutesPlugin.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { DiscordAPIError, Snowflake } from "discord.js";
|
import { DiscordAPIError, Snowflake } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { CaseTypes } from "../../../data/CaseTypes.js";
|
import { CaseTypes } from "../../../data/CaseTypes.js";
|
||||||
import { LogType } from "../../../data/LogType.js";
|
import { LogType } from "../../../data/LogType.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Snowflake } from "discord.js";
|
import { Snowflake } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { CaseTypes } from "../../../data/CaseTypes.js";
|
import { CaseTypes } from "../../../data/CaseTypes.js";
|
||||||
|
|
|
@ -8,7 +8,7 @@ import {
|
||||||
} from "discord.js";
|
} from "discord.js";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||||
import { humanizeDurationShort } from "../../../humanizeDurationShort.js";
|
import { humanizeDurationShort } from "../../../humanizeDuration.js";
|
||||||
import { getBaseUrl } from "../../../pluginUtils.js";
|
import { getBaseUrl } from "../../../pluginUtils.js";
|
||||||
import { DBDateFormat, MINUTES, renderUsername, resolveMember } from "../../../utils.js";
|
import { DBDateFormat, MINUTES, renderUsername, resolveMember } from "../../../utils.js";
|
||||||
import { IMuteWithDetails, mutesCmd } from "../types.js";
|
import { IMuteWithDetails, mutesCmd } from "../types.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Snowflake } from "discord.js";
|
import { Snowflake } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
import { ERRORS, RecoverablePluginError } from "../../../RecoverablePluginError.js";
|
||||||
import { CaseTypes } from "../../../data/CaseTypes.js";
|
import { CaseTypes } from "../../../data/CaseTypes.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Snowflake } from "discord.js";
|
import { Snowflake } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { CaseTypes } from "../../../data/CaseTypes.js";
|
import { CaseTypes } from "../../../data/CaseTypes.js";
|
||||||
import { AddMuteParams } from "../../../data/GuildMutes.js";
|
import { AddMuteParams } from "../../../data/GuildMutes.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { escapeCodeBlock } from "discord.js";
|
import { escapeCodeBlock } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { createChunkedMessage, DBDateFormat, deactivateMentions, sorter, trimLines } from "../../../utils.js";
|
import { createChunkedMessage, DBDateFormat, deactivateMentions, sorter, trimLines } from "../../../utils.js";
|
||||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
|
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { GuildTextBasedChannel, Message } from "discord.js";
|
import { GuildTextBasedChannel, Message } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { registerUpcomingScheduledPost } from "../../../data/loops/upcomingScheduledPostsLoop.js";
|
import { registerUpcomingScheduledPost } from "../../../data/loops/upcomingScheduledPostsLoop.js";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||||
import { registerUpcomingReminder } from "../../../data/loops/upcomingRemindersLoop.js";
|
import { registerUpcomingReminder } from "../../../data/loops/upcomingRemindersLoop.js";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { createChunkedMessage, DBDateFormat, sorter } from "../../../utils.js";
|
import { createChunkedMessage, DBDateFormat, sorter } from "../../../utils.js";
|
||||||
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
|
import { TimeAndDatePlugin } from "../../TimeAndDate/TimeAndDatePlugin.js";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||||
import { slowmodeCmd } from "../types.js";
|
import { slowmodeCmd } from "../types.js";
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { GuildChannel, TextChannel } from "discord.js";
|
import { GuildChannel, TextChannel } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { createChunkedMessage } from "knub/helpers";
|
import { createChunkedMessage } from "knub/helpers";
|
||||||
import { errorMessage } from "../../../utils.js";
|
import { errorMessage } from "../../../utils.js";
|
||||||
import { slowmodeCmd } from "../types.js";
|
import { slowmodeCmd } from "../types.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { escapeInlineCode, PermissionsBitField } from "discord.js";
|
import { escapeInlineCode, PermissionsBitField } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||||
import { asSingleLine, DAYS, HOURS, MINUTES } from "../../../utils.js";
|
import { asSingleLine, DAYS, HOURS, MINUTES } from "../../../utils.js";
|
||||||
import { getMissingPermissions } from "../../../utils/getMissingPermissions.js";
|
import { getMissingPermissions } from "../../../utils/getMissingPermissions.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Snowflake } from "discord.js";
|
import { Snowflake } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../humanizeDuration.js";
|
||||||
import { PluginOptions, guildPlugin } from "knub";
|
import { PluginOptions, guildPlugin } from "knub";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
import { GuildArchives } from "../../data/GuildArchives.js";
|
import { GuildArchives } from "../../data/GuildArchives.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { APIEmbed, GuildChannel } from "discord.js";
|
import { APIEmbed, GuildChannel } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import LCL from "last-commit-log";
|
import LCL from "last-commit-log";
|
||||||
import shuffle from "lodash/shuffle.js";
|
import shuffle from "lodash/shuffle.js";
|
||||||
import moment from "moment-timezone";
|
import moment from "moment-timezone";
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { allowTimeout } from "../../../RegExpRunner.js";
|
||||||
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
import { commandTypeHelpers as ct } from "../../../commandTypes.js";
|
||||||
import { LogType } from "../../../data/LogType.js";
|
import { LogType } from "../../../data/LogType.js";
|
||||||
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
import { SavedMessage } from "../../../data/entities/SavedMessage.js";
|
||||||
import { humanizeDurationShort } from "../../../humanizeDurationShort.js";
|
import { humanizeDurationShort } from "../../../humanizeDuration.js";
|
||||||
import { getBaseUrl } from "../../../pluginUtils.js";
|
import { getBaseUrl } from "../../../pluginUtils.js";
|
||||||
import { ModActionsPlugin } from "../../../plugins/ModActions/ModActionsPlugin.js";
|
import { ModActionsPlugin } from "../../../plugins/ModActions/ModActionsPlugin.js";
|
||||||
import { DAYS, SECONDS, chunkArray, getInviteCodesInString, noop } from "../../../utils.js";
|
import { DAYS, SECONDS, chunkArray, getInviteCodesInString, noop } from "../../../utils.js";
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { APIEmbed, ChannelType, Snowflake, StageChannel, VoiceChannel } from "discord.js";
|
import { APIEmbed, ChannelType, Snowflake, StageChannel, VoiceChannel } from "discord.js";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration } from "../../../humanizeDuration.js";
|
||||||
import { GuildPluginData } from "knub";
|
import { GuildPluginData } from "knub";
|
||||||
import { EmbedWith, MINUTES, formatNumber, preEmbedPadding, trimLines, verboseUserMention } from "../../../utils.js";
|
import { EmbedWith, MINUTES, formatNumber, preEmbedPadding, trimLines, verboseUserMention } from "../../../utils.js";
|
||||||
import { UtilityPluginType } from "../types.js";
|
import { UtilityPluginType } from "../types.js";
|
||||||
|
|
|
@ -29,7 +29,7 @@ import {
|
||||||
import emojiRegex from "emoji-regex";
|
import emojiRegex from "emoji-regex";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import https from "https";
|
import https from "https";
|
||||||
import humanizeDuration from "humanize-duration";
|
import { humanizeDuration, delayStringMultipliers } from "./humanizeDuration.js";
|
||||||
import isEqual from "lodash/isEqual.js";
|
import isEqual from "lodash/isEqual.js";
|
||||||
import { performance } from "perf_hooks";
|
import { performance } from "perf_hooks";
|
||||||
import tlds from "tlds" assert { type: "json" };
|
import tlds from "tlds" assert { type: "json" };
|
||||||
|
@ -45,21 +45,14 @@ import { waitForButtonConfirm } from "./utils/waitForInteraction.js";
|
||||||
|
|
||||||
const fsp = fs.promises;
|
const fsp = fs.promises;
|
||||||
|
|
||||||
const delayStringMultipliers = {
|
|
||||||
w: 1000 * 60 * 60 * 24 * 7,
|
|
||||||
d: 1000 * 60 * 60 * 24,
|
|
||||||
h: 1000 * 60 * 60,
|
|
||||||
m: 1000 * 60,
|
|
||||||
s: 1000,
|
|
||||||
x: 1,
|
|
||||||
};
|
|
||||||
|
|
||||||
export const MS = 1;
|
export const MS = 1;
|
||||||
export const SECONDS = 1000 * MS;
|
export const SECONDS = 1000 * MS;
|
||||||
export const MINUTES = 60 * SECONDS;
|
export const MINUTES = 60 * SECONDS;
|
||||||
export const HOURS = 60 * MINUTES;
|
export const HOURS = 60 * MINUTES;
|
||||||
export const DAYS = 24 * HOURS;
|
export const DAYS = 24 * HOURS;
|
||||||
export const WEEKS = 7 * 24 * HOURS;
|
export const WEEKS = 7 * DAYS;
|
||||||
|
export const YEARS = (365 + 1/4 - 1/100 + 1/400) * DAYS;
|
||||||
|
export const MONTHS = YEARS / 12
|
||||||
|
|
||||||
export const EMPTY_CHAR = "\u200b";
|
export const EMPTY_CHAR = "\u200b";
|
||||||
|
|
||||||
|
@ -408,7 +401,7 @@ const MAX_DELAY_STRING_AMOUNT = 100 * 365 * DAYS;
|
||||||
* Turns a "delay string" such as "1h30m" to milliseconds
|
* Turns a "delay string" such as "1h30m" to milliseconds
|
||||||
*/
|
*/
|
||||||
export function convertDelayStringToMS(str, defaultUnit = "m"): number | null {
|
export function convertDelayStringToMS(str, defaultUnit = "m"): number | null {
|
||||||
const regex = /^([0-9]+)\s*([wdhms])?[a-z]*\s*/;
|
const regex = /^([0-9]+)\s*((?:mo?)|[ywdhs])?[a-z]*\s*/;
|
||||||
let match;
|
let match;
|
||||||
let ms = 0;
|
let ms = 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue