koishi-plugin-toram 0.2.5 → 0.2.6-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/index.js +3 -3
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -60,11 +60,11 @@ async function apply(ctx, config) {
|
|
|
60
60
|
const 截止时间_月 = Number(截止时间拆分[0]);
|
|
61
61
|
const 截止时间_日 = Number(截止时间拆分[1].replace(/日(前|上午|下午|晚)?$/, ''));
|
|
62
62
|
const [当前时间_年, 当前时间_月, 当前时间_日] = 当前时间date.toLocaleDateString().split('-');
|
|
63
|
-
const 截止时间_年 = 截止时间_月 < Number(当前时间_月)
|
|
63
|
+
const 截止时间_年 = 截止时间_月 < Number(当前时间_月) || (截止时间_月 === Number(当前时间_月) && 截止时间_日 < Number(当前时间_日)) ? Number(当前时间_年) + 1 : Number(当前时间_年);
|
|
64
64
|
const 截止时间字符串 = `${截止时间_年}-${截止时间_月}-${截止时间_日}`;
|
|
65
65
|
const 截止时间date = new Date(截止时间字符串);
|
|
66
66
|
const [检测时间_年, 检测时间_月, 检测时间_日] = 截止时间date.toLocaleDateString().split('-');
|
|
67
|
-
const 检测时间字符串 = `${检测时间_年}-${Number(检测时间_月)
|
|
67
|
+
const 检测时间字符串 = `${检测时间_年}-${Number(检测时间_月)}-${检测时间_日}`;
|
|
68
68
|
if (isNaN(截止时间date.getTime()) || 检测时间字符串 != 截止时间字符串) {
|
|
69
69
|
return '你确定是这个日期吗?';
|
|
70
70
|
}
|
|
@@ -74,7 +74,7 @@ async function apply(ctx, config) {
|
|
|
74
74
|
const 截止时间后缀 = 截止时间.split("日")[1];
|
|
75
75
|
const 截止时间戳增加 = Number(时间戳增加对应[截止时间后缀]) || 24 * 60 * 60 * 1000;
|
|
76
76
|
截止时间戳 += 截止时间戳增加;
|
|
77
|
-
const 今日时间date = new Date(Number(当前时间_年), Number(当前时间_月), Number(当前时间_日));
|
|
77
|
+
const 今日时间date = new Date(Number(当前时间_年), Number(当前时间_月) - 1, Number(当前时间_日));
|
|
78
78
|
const 最大时间戳 = 今日时间date.getTime() + (config.组队_未来天数 + 1) * 24 * 60 * 60 * 1000;
|
|
79
79
|
if (截止时间戳 > 最大时间戳 || 截止时间戳 < 当前时间date.getTime()) {
|
|
80
80
|
return '只支持输入未来' + config.组队_未来天数 + '天的时间哦~';
|