mirror of
https://github.com/ZZZure/ZZZ-Plugin.git
synced 2025-12-17 05:37:46 +00:00
fix: 修复时间正则匹配
This commit is contained in:
parent
3823ca8811
commit
7359981c19
1 changed files with 4 additions and 4 deletions
|
|
@ -78,16 +78,16 @@ export class Remind extends ZZZPlugin {
|
|||
if (remindTime.includes('每日')) {
|
||||
const match = remindTime.match(/每日(\d+)时/);
|
||||
if (match) {
|
||||
const hour = parseInt(match, 10);
|
||||
const hour = parseInt(match[1], 10);
|
||||
return currentHour === hour;
|
||||
}
|
||||
} else if (remindTime.includes('每周')) {
|
||||
const dayMap = { '日': 0, '一': 1, '二': 2, '三': 3, '四': 4, '五': 5, '六': 6 };
|
||||
const match = remindTime.match(/每周(.)(\d+)时/);
|
||||
if (match) {
|
||||
const dayChar = match;
|
||||
const hour = parseInt(match, 10);
|
||||
const day = dayMap[dayChar];
|
||||
const dayChar = match[1];
|
||||
const hour = parseInt(match[2], 10);
|
||||
const day = dayMap[dayChar] || parseInt(dayChar, 10);
|
||||
return currentDay === day && currentHour === hour;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue