[backend] fix: 修复异常处理和类型转换问题

This commit is contained in:
xsl
2026-01-26 11:53:40 +08:00
parent 7ccc2a6ac6
commit 83e05bf85f
28639 changed files with 2506458 additions and 93 deletions
+21
View File
@@ -0,0 +1,21 @@
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
import { isSame } from "../utils/dateUtil";
/**
* Toggles the presence of a value in an array.
* If the value exists in the array, removed it.
* Else add it.
*/
export default function useToggleDates(generateConfig, locale, panelMode) {
function toggleDates(list, target) {
var index = list.findIndex(function (date) {
return isSame(generateConfig, locale, date, target, panelMode);
});
if (index === -1) {
return [].concat(_toConsumableArray(list), [target]);
}
var sliceList = _toConsumableArray(list);
sliceList.splice(index, 1);
return sliceList;
}
return toggleDates;
}