chore: merge dev to main #181

Merged
Anri merged 40 commits from dev into main 2024-09-27 20:49:36 +02:00
2 changed files with 4 additions and 5 deletions
Showing only changes of commit 78a84faca4 - Show all commits

View file

@ -52,14 +52,13 @@ export const splitTime = (time: string) => {
[OptionReminder.Mention]: "@", [OptionReminder.Mention]: "@",
}; };
const lowered = time.toLowerCase(); const trimmed = time.replaceAll(
const trimmed = lowered.replaceAll( RegexC(Object.values(mapping).join("|"), RegExpFlags.Global | RegExpFlags.Insensitive),
RegexC(Object.values(mapping).join("|"), RegExpFlags.Global),
"", "",
); );
// Depending of the last character of the string // Depending of the last character of the string
switch (lowered.slice(-1)) { switch (time.toLowerCase().slice(-1)) {
case mapping[OptionReminder.Mention]: case mapping[OptionReminder.Mention]:
return { time: trimmed, option: OptionReminder.Mention }; return { time: trimmed, option: OptionReminder.Mention };
case mapping[OptionReminder.DirectMessage]: case mapping[OptionReminder.DirectMessage]:

View file

@ -53,7 +53,7 @@ export const strToSeconds = (time: string) => {
RegExpFlags.Global | RegExpFlags.Insensitive, RegExpFlags.Global | RegExpFlags.Insensitive,
); );
const data = Object.assign({}, regex.exec(time.toLowerCase())?.groups); const data = Object.assign({}, regex.exec(time)?.groups);
if (Object.keys(data).length === 0) { if (Object.keys(data).length === 0) {
// Regex returned an invalid time // Regex returned an invalid time