@ivujs/i-utils 2.1.2 → 2.1.3

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.
@@ -1106,7 +1106,7 @@ function toDateUTC(date = new Date()) {
1106
1106
  * const localDate = new Date('2025-01-26 08:00:00');
1107
1107
  * console.log(toUTCString(localDate)); // 2025-01-26 00:00:00
1108
1108
  */
1109
- function toDataUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:mm:ss" }) {
1109
+ function toDateUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:mm:ss" }) {
1110
1110
  const utcDate = toDateUTC(date);
1111
1111
  return toDateString(utcDate, options);
1112
1112
  }
@@ -1117,8 +1117,9 @@ function toDataUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:m
1117
1117
  * @returns {Date} 返回日期对象
1118
1118
  */
1119
1119
  function toDate(value) {
1120
+ // 为空抛出异常
1120
1121
  if (index$1.isNull(value)) {
1121
- throw new TypeError("value must be a string or number");
1122
+ throw new TypeError("value cannot be null or undefined");
1122
1123
  }
1123
1124
  // 是日期字符串
1124
1125
  if (index$1.isString(value)) {
@@ -1134,7 +1135,7 @@ function toDate(value) {
1134
1135
  }
1135
1136
  // 不支持的日期格式
1136
1137
  else {
1137
- throw new Error("Not supported date format");
1138
+ throw new TypeError(`invalid input type: ${typeof value}, expected string or number`);
1138
1139
  }
1139
1140
  }
1140
1141
  /**
@@ -1146,13 +1147,13 @@ function toDate(value) {
1146
1147
  */
1147
1148
  function toDateString(date$1, options = { format: "yyyy-MM-dd", lang: "zh" }) {
1148
1149
  const { format = "yyyy-MM-dd", lang = "zh" } = options;
1150
+ // 为空抛出异常
1149
1151
  if (index$1.isNull(date$1)) {
1150
- throw new TypeError("date input is null");
1152
+ throw new TypeError("date cannot be null or undefined");
1151
1153
  }
1152
1154
  // 判断是否是日期对象
1153
1155
  if (!index$1.isDate(date$1)) {
1154
- console.error("Not a Date type!");
1155
- return "";
1156
+ throw new TypeError(`invalid input type: ${typeof date$1}, expected Date object`);
1156
1157
  }
1157
1158
  // 日期转化替换
1158
1159
  const replaceRules = {
@@ -1328,10 +1329,10 @@ exports.lastYear = lastYear;
1328
1329
  exports.nextMonth = nextMonth;
1329
1330
  exports.nextWeek = nextWeek;
1330
1331
  exports.nextYear = nextYear;
1331
- exports.toDataUTCString = toDataUTCString;
1332
1332
  exports.toDate = toDate;
1333
1333
  exports.toDateString = toDateString;
1334
1334
  exports.toDateUTC = toDateUTC;
1335
+ exports.toDateUTCString = toDateUTCString;
1335
1336
  exports.today = today;
1336
1337
  exports.tomorrow = tomorrow;
1337
1338
  exports.yesterday = yesterday;
@@ -195,10 +195,10 @@ exports.lastYear = index$5.lastYear;
195
195
  exports.nextMonth = index$5.nextMonth;
196
196
  exports.nextWeek = index$5.nextWeek;
197
197
  exports.nextYear = index$5.nextYear;
198
- exports.toDataUTCString = index$5.toDataUTCString;
199
198
  exports.toDate = index$5.toDate;
200
199
  exports.toDateString = index$5.toDateString;
201
200
  exports.toDateUTC = index$5.toDateUTC;
201
+ exports.toDateUTCString = index$5.toDateUTCString;
202
202
  exports.today = index$5.today;
203
203
  exports.tomorrow = index$5.tomorrow;
204
204
  exports.yesterday = index$5.yesterday;
@@ -619,7 +619,7 @@ export declare function toDateUTC(date?: Date): Date;
619
619
  * const localDate = new Date('2025-01-26 08:00:00');
620
620
  * console.log(toUTCString(localDate)); // 2025-01-26 00:00:00
621
621
  */
622
- export declare function toDataUTCString(date?: Date, options?: DateOptions): string;
622
+ export declare function toDateUTCString(date?: Date, options?: DateOptions): string;
623
623
  /**
624
624
  * 日期字符串转为日期对象
625
625
  * @description 支持日期字符串,时间戳,Unix时间戳
@@ -1104,7 +1104,7 @@ function toDateUTC(date = new Date()) {
1104
1104
  * const localDate = new Date('2025-01-26 08:00:00');
1105
1105
  * console.log(toUTCString(localDate)); // 2025-01-26 00:00:00
1106
1106
  */
1107
- function toDataUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:mm:ss" }) {
1107
+ function toDateUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:mm:ss" }) {
1108
1108
  const utcDate = toDateUTC(date);
1109
1109
  return toDateString(utcDate, options);
1110
1110
  }
@@ -1115,8 +1115,9 @@ function toDataUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:m
1115
1115
  * @returns {Date} 返回日期对象
1116
1116
  */
1117
1117
  function toDate(value) {
1118
+ // 为空抛出异常
1118
1119
  if (isNull(value)) {
1119
- throw new TypeError("value must be a string or number");
1120
+ throw new TypeError("value cannot be null or undefined");
1120
1121
  }
1121
1122
  // 是日期字符串
1122
1123
  if (isString(value)) {
@@ -1132,7 +1133,7 @@ function toDate(value) {
1132
1133
  }
1133
1134
  // 不支持的日期格式
1134
1135
  else {
1135
- throw new Error("Not supported date format");
1136
+ throw new TypeError(`invalid input type: ${typeof value}, expected string or number`);
1136
1137
  }
1137
1138
  }
1138
1139
  /**
@@ -1144,13 +1145,13 @@ function toDate(value) {
1144
1145
  */
1145
1146
  function toDateString(date, options = { format: "yyyy-MM-dd", lang: "zh" }) {
1146
1147
  const { format = "yyyy-MM-dd", lang = "zh" } = options;
1148
+ // 为空抛出异常
1147
1149
  if (isNull(date)) {
1148
- throw new TypeError("date input is null");
1150
+ throw new TypeError("date cannot be null or undefined");
1149
1151
  }
1150
1152
  // 判断是否是日期对象
1151
1153
  if (!isDate(date)) {
1152
- console.error("Not a Date type!");
1153
- return "";
1154
+ throw new TypeError(`invalid input type: ${typeof date}, expected Date object`);
1154
1155
  }
1155
1156
  // 日期转化替换
1156
1157
  const replaceRules = {
@@ -1244,4 +1245,4 @@ function _datePadZero(value) {
1244
1245
  return num > 9 ? String(num) : "0" + num;
1245
1246
  }
1246
1247
 
1247
- export { addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addWeek, addYear, fromDateUTC, getAge, getBetweenDates, getBetweenMonths, getBetweenYears, getChineseZodiac, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getNow, getOverTime, getPastTime, getQuarter, getTimestamp, getUnixTimestamp, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, isAM, isAfter, isAfterTomorrow, isBefore, isBeforeYesterday, isBetween, isCommonYear, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isPM, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isToday, isTomorrow, isWeekend, isWorkday, isYesterday, lastMonth, lastWeek, lastYear, nextMonth, nextWeek, nextYear, toDataUTCString, toDate, toDateString, toDateUTC, today, tomorrow, yesterday };
1248
+ export { addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addWeek, addYear, fromDateUTC, getAge, getBetweenDates, getBetweenMonths, getBetweenYears, getChineseZodiac, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getNow, getOverTime, getPastTime, getQuarter, getTimestamp, getUnixTimestamp, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, isAM, isAfter, isAfterTomorrow, isBefore, isBeforeYesterday, isBetween, isCommonYear, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isPM, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isToday, isTomorrow, isWeekend, isWorkday, isYesterday, lastMonth, lastWeek, lastYear, nextMonth, nextWeek, nextYear, toDate, toDateString, toDateUTC, toDateUTCString, today, tomorrow, yesterday };
package/dist/es/index.mjs CHANGED
@@ -10,7 +10,7 @@ export { parseFloat, parseInt } from './number/index.mjs';
10
10
  export { arrayAvg, arrayBottom, arrayComplement, arrayCreate, arrayDifference, arrayDown, arrayEquals, arrayInsert, arrayInsertAfter, arrayInsertBefore, arrayIntersect, arrayMax, arrayMin, arrayRemove, arrayRemoveAfter, arrayRemoveBefore, arrayShuffle, arraySort, arraySortBy, arraySum, arraySwap, arrayToTree, arrayTop, arrayUnion, arrayUnique, arrayUp, inArray, treeToArray } from './array/index.mjs';
11
11
  export { clone, deepClone, getValueByPath, jsonToMap, mapToJson, mapToObject, merge, objectEquals, objectToMap, parseJson, setValueByPath, stringifyJson } from './object/index.mjs';
12
12
  export { debounce, sleep, throttle } from './function/index.mjs';
13
- export { addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addWeek, addYear, fromDateUTC, getAge, getBetweenDates, getBetweenMonths, getBetweenYears, getChineseZodiac, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getNow, getOverTime, getPastTime, getQuarter, getTimestamp, getUnixTimestamp, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, isAM, isAfter, isAfterTomorrow, isBefore, isBeforeYesterday, isBetween, isCommonYear, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isPM, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isToday, isTomorrow, isWeekend, isWorkday, isYesterday, lastMonth, lastWeek, lastYear, nextMonth, nextWeek, nextYear, toDataUTCString, toDate, toDateString, toDateUTC, today, tomorrow, yesterday } from './date/index.mjs';
13
+ export { addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addWeek, addYear, fromDateUTC, getAge, getBetweenDates, getBetweenMonths, getBetweenYears, getChineseZodiac, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getNow, getOverTime, getPastTime, getQuarter, getTimestamp, getUnixTimestamp, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, isAM, isAfter, isAfterTomorrow, isBefore, isBeforeYesterday, isBetween, isCommonYear, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isPM, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isToday, isTomorrow, isWeekend, isWorkday, isYesterday, lastMonth, lastWeek, lastYear, nextMonth, nextWeek, nextYear, toDate, toDateString, toDateUTC, toDateUTCString, today, tomorrow, yesterday } from './date/index.mjs';
14
14
  export { add, divide, gcd, modulo, multiply, scm, subtract, toDecimal, toFixed } from './math/index.mjs';
15
15
  export { isChinese, isEmail, isEnglish, isExternal, isIdCard, isLowerCase, isMobile, isUpperCase, isUrl, regexpTest } from './regexp/index.mjs';
16
16
  export { getRandom, getRandomDigit } from './random/index.mjs';
package/dist/index.d.ts CHANGED
@@ -1370,7 +1370,7 @@ declare function toDateUTC(date?: Date): Date;
1370
1370
  * const localDate = new Date('2025-01-26 08:00:00');
1371
1371
  * console.log(toUTCString(localDate)); // 2025-01-26 00:00:00
1372
1372
  */
1373
- declare function toDataUTCString(date?: Date, options?: DateOptions): string;
1373
+ declare function toDateUTCString(date?: Date, options?: DateOptions): string;
1374
1374
  /**
1375
1375
  * 日期字符串转为日期对象
1376
1376
  * @description 支持日期字符串,时间戳,Unix时间戳
@@ -2694,5 +2694,5 @@ declare function clearClipboard(): Promise<any>;
2694
2694
 
2695
2695
  declare function testLoaded(): void;
2696
2696
 
2697
- export { DATE, ID_CARD, KEYCODE, LANG, MATH, REGEXP, SM4, SORT, add, addClass, addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addStyle, addWeek, addYear, appendSearchParam, appendToSearchParam, arrayAvg, arrayBottom, arrayComplement, arrayCreate, arrayDifference, arrayDown, arrayEquals, arrayInsert, arrayInsertAfter, arrayInsertBefore, arrayIntersect, arrayMax, arrayMin, arrayRemove, arrayRemoveAfter, arrayRemoveBefore, arrayShuffle, arraySort, arraySortBy, arraySum, arraySwap, arrayToTree, arrayTop, arrayUnion, arrayUnique, arrayUp, base64Decode, base64DecodeURI, base64Encode, base64EncodeURI, base64FromHex, base64FromUint8Array, base64ToBlob, base64ToFile, base64ToHex, base64ToUint8Array, blobToBase64, blobToFile, blobToText, clearClipboard, clearCookie, clearLocalStorage, clearSessionStorage, clone, debounce, deepClone, deepCompare, divide, downloadBlobFile, downloadFileUrl, equals, equalsIgnoreCase, fileToBase64, fileToBlob, fileToUrl, formatFileSize, formatRmbChinese, formatStartOf, formatStartOfBankCard, formatStartOfIDCard, formatStartOfMobile, formatStartOfName, formatTemplate, formatThousand, formatTitle, fromDateUTC, gcd, generateSM4Iv, generateSM4Key, getAge, getAgeByIDCard, getBetweenDates, getBetweenMonths, getBetweenYears, getBirthdayByIDCard, getBrowserInfo, getChineseZodiac, getClipboard, getClipboardText, getCookie, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getDrawHex, getDrawRgb, getDrawRgba, getFileName, getFileSuffix, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getGUID, getHost, getHostName, getInfoByIDCard, getKeyCode, getKeyName, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getLimit, getLocalStorage, getNextPage, getNow, getOverTime, getPastTime, getPort, getPrevPage, getProtocol, getProvinceByIDCard, getQuarter, getRainbowPager, getRandom, getRandomDigit, getSearchParam, getSearchString, getSessionStorage, getSexByIDCard, getStyle, getTimestamp, getTotalPage, getUUID, getUnixTimestamp, getUrlHash, getUrlPath, getValueByPath, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, hasClass, hasSearchParam, hexToHsl, hexToRgb, hexToRgba, htmlDecode, htmlEncode, inArray, inString, isAM, isAfter, isAfterTomorrow, isAndroid, isArray, isAsyncFunction, isBefore, isBeforeYesterday, isBetween, isBigInt, isBlank, isBoolean, isChinese, isCommonYear, isDate, isDecimal, isEmail, isEmpty, isEnglish, isError, isExternal, isFalse, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isFunction, isFunctionString, isIdCard, isInteger, isIos, isIpad, isIphone, isJson, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isLinux, isLowerCase, isMac, isMap, isMobile, isNaN, isNotBlank, isNotEmpty, isNotNaN, isNotNull, isNotUndefined, isNull, isNumber, isObject, isPM, isPc, isPhone, isPromise, isQQ, isRegExp, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isSet, isString, isSupportCookie, isSupportStorage, isSymbol, isToday, isTomorrow, isTrue, isUndefined, isUpperCase, isUrl, isWeakMap, isWeakSet, isWeekend, isWeixin, isWindows, isWindowsPhone, isWorkday, isYesterday, jsonToMap, lastMonth, lastWeek, lastYear, mapToJson, mapToObject, md5, md5Hmac, md5HmacRaw, md5Raw, merge, modulo, multiply, nextMonth, nextWeek, nextYear, objectEquals, objectToMap, padZeroEnd, padZeroStart, parseFloat, parseInt, parseJson, parseSearchParam, prependSearchParam, prependToSearchParam, regexpTest, removeClass, removeCookie, removeLocalStorage, removeSearchParam, removeSessionStorage, removeStyle, replaceAll, replaceClass, rgbToHex, rgbaToHex, rgbaToHsl, scm, setClipboard, setClipboardText, setCookie, setLocalStorage, setSearchParam, setSessionStorage, setValueByPath, sha224, sha224Hmac, sha224HmacRaw, sha224Raw, sha256, sha256Hmac, sha256HmacRaw, sha256Raw, sleep, sm3Encrypt, sm3EncryptHmac, sm4Decrypt, sm4Encrypt, stringifyJson, stringifySearchParam, subtract, testLoaded, throttle, toCamelCase, toDataUTCString, toDate, toDateString, toDateUTC, toDecimal, toFixed, toKebabCase, toLowerCase, toPascalCase, toSnakeCase, toUpperCase, today, tomorrow, treeToArray, trim, trimAll, trimEnd, trimStart, urlToBase64, urlToFile, yesterday };
2697
+ export { DATE, ID_CARD, KEYCODE, LANG, MATH, REGEXP, SM4, SORT, add, addClass, addDate, addHours, addMillisecond, addMinutes, addMonth, addQuarter, addSeconds, addStyle, addWeek, addYear, appendSearchParam, appendToSearchParam, arrayAvg, arrayBottom, arrayComplement, arrayCreate, arrayDifference, arrayDown, arrayEquals, arrayInsert, arrayInsertAfter, arrayInsertBefore, arrayIntersect, arrayMax, arrayMin, arrayRemove, arrayRemoveAfter, arrayRemoveBefore, arrayShuffle, arraySort, arraySortBy, arraySum, arraySwap, arrayToTree, arrayTop, arrayUnion, arrayUnique, arrayUp, base64Decode, base64DecodeURI, base64Encode, base64EncodeURI, base64FromHex, base64FromUint8Array, base64ToBlob, base64ToFile, base64ToHex, base64ToUint8Array, blobToBase64, blobToFile, blobToText, clearClipboard, clearCookie, clearLocalStorage, clearSessionStorage, clone, debounce, deepClone, deepCompare, divide, downloadBlobFile, downloadFileUrl, equals, equalsIgnoreCase, fileToBase64, fileToBlob, fileToUrl, formatFileSize, formatRmbChinese, formatStartOf, formatStartOfBankCard, formatStartOfIDCard, formatStartOfMobile, formatStartOfName, formatTemplate, formatThousand, formatTitle, fromDateUTC, gcd, generateSM4Iv, generateSM4Key, getAge, getAgeByIDCard, getBetweenDates, getBetweenMonths, getBetweenYears, getBirthdayByIDCard, getBrowserInfo, getChineseZodiac, getClipboard, getClipboardText, getCookie, getDate, getDateArray, getDateObject, getDateTime, getDayOfMonth, getDayOfWeek, getDayOfYear, getDaysOfMonth, getDaysOfWeek, getDaysOfYear, getDiffDay, getDiffMonth, getDiffWeek, getDiffYear, getDrawHex, getDrawRgb, getDrawRgba, getFileName, getFileSuffix, getFirstDateOfMonth, getFirstDateOfWeek, getFirstDateOfYear, getFullDateOfMonth, getFullDateOfWeek, getFullDateOfYear, getGUID, getHost, getHostName, getInfoByIDCard, getKeyCode, getKeyName, getLastDateOfMonth, getLastDateOfWeek, getLastDateOfYear, getLimit, getLocalStorage, getNextPage, getNow, getOverTime, getPastTime, getPort, getPrevPage, getProtocol, getProvinceByIDCard, getQuarter, getRainbowPager, getRandom, getRandomDigit, getSearchParam, getSearchString, getSessionStorage, getSexByIDCard, getStyle, getTimestamp, getTotalPage, getUUID, getUnixTimestamp, getUrlHash, getUrlPath, getValueByPath, getWeek, getWeekOfMonth, getWeekOfYear, getWeeksOfMonth, getWeeksOfYear, getZodiac, hasClass, hasSearchParam, hexToHsl, hexToRgb, hexToRgba, htmlDecode, htmlEncode, inArray, inString, isAM, isAfter, isAfterTomorrow, isAndroid, isArray, isAsyncFunction, isBefore, isBeforeYesterday, isBetween, isBigInt, isBlank, isBoolean, isChinese, isCommonYear, isDate, isDecimal, isEmail, isEmpty, isEnglish, isError, isExternal, isFalse, isFirstDayOfMonth, isFirstDayOfWeek, isFirstDayOfYear, isFunction, isFunctionString, isIdCard, isInteger, isIos, isIpad, isIphone, isJson, isLastDayOfMonth, isLastDayOfWeek, isLastDayOfYear, isLeapYear, isLinux, isLowerCase, isMac, isMap, isMobile, isNaN, isNotBlank, isNotEmpty, isNotNaN, isNotNull, isNotUndefined, isNull, isNumber, isObject, isPM, isPc, isPhone, isPromise, isQQ, isRegExp, isSame, isSameMonth, isSameOrAfter, isSameOrBefore, isSameWeek, isSameYear, isSet, isString, isSupportCookie, isSupportStorage, isSymbol, isToday, isTomorrow, isTrue, isUndefined, isUpperCase, isUrl, isWeakMap, isWeakSet, isWeekend, isWeixin, isWindows, isWindowsPhone, isWorkday, isYesterday, jsonToMap, lastMonth, lastWeek, lastYear, mapToJson, mapToObject, md5, md5Hmac, md5HmacRaw, md5Raw, merge, modulo, multiply, nextMonth, nextWeek, nextYear, objectEquals, objectToMap, padZeroEnd, padZeroStart, parseFloat, parseInt, parseJson, parseSearchParam, prependSearchParam, prependToSearchParam, regexpTest, removeClass, removeCookie, removeLocalStorage, removeSearchParam, removeSessionStorage, removeStyle, replaceAll, replaceClass, rgbToHex, rgbaToHex, rgbaToHsl, scm, setClipboard, setClipboardText, setCookie, setLocalStorage, setSearchParam, setSessionStorage, setValueByPath, sha224, sha224Hmac, sha224HmacRaw, sha224Raw, sha256, sha256Hmac, sha256HmacRaw, sha256Raw, sleep, sm3Encrypt, sm3EncryptHmac, sm4Decrypt, sm4Encrypt, stringifyJson, stringifySearchParam, subtract, testLoaded, throttle, toCamelCase, toDate, toDateString, toDateUTC, toDateUTCString, toDecimal, toFixed, toKebabCase, toLowerCase, toPascalCase, toSnakeCase, toUpperCase, today, tomorrow, treeToArray, trim, trimAll, trimEnd, trimStart, urlToBase64, urlToFile, yesterday };
2698
2698
  export type { DateOptions, SM4DataType, SM4Options };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @ivujs/i-utils v2.1.2
2
+ * @ivujs/i-utils v2.1.3
3
3
  * Copyright 2021-2026, <gao911222@163.com>
4
4
  * Released under the MIT License.
5
5
  */
@@ -3444,7 +3444,7 @@
3444
3444
  * const localDate = new Date('2025-01-26 08:00:00');
3445
3445
  * console.log(toUTCString(localDate)); // 2025-01-26 00:00:00
3446
3446
  */
3447
- function toDataUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:mm:ss" }) {
3447
+ function toDateUTCString(date = new Date(), options = { format: "yyyy-MM-dd HH:mm:ss" }) {
3448
3448
  const utcDate = toDateUTC(date);
3449
3449
  return toDateString(utcDate, options);
3450
3450
  }
@@ -3455,8 +3455,9 @@
3455
3455
  * @returns {Date} 返回日期对象
3456
3456
  */
3457
3457
  function toDate(value) {
3458
+ // 为空抛出异常
3458
3459
  if (isNull(value)) {
3459
- throw new TypeError("value must be a string or number");
3460
+ throw new TypeError("value cannot be null or undefined");
3460
3461
  }
3461
3462
  // 是日期字符串
3462
3463
  if (isString(value)) {
@@ -3472,7 +3473,7 @@
3472
3473
  }
3473
3474
  // 不支持的日期格式
3474
3475
  else {
3475
- throw new Error("Not supported date format");
3476
+ throw new TypeError(`invalid input type: ${typeof value}, expected string or number`);
3476
3477
  }
3477
3478
  }
3478
3479
  /**
@@ -3484,13 +3485,13 @@
3484
3485
  */
3485
3486
  function toDateString(date, options = { format: "yyyy-MM-dd", lang: "zh" }) {
3486
3487
  const { format = "yyyy-MM-dd", lang = "zh" } = options;
3488
+ // 为空抛出异常
3487
3489
  if (isNull(date)) {
3488
- throw new TypeError("date input is null");
3490
+ throw new TypeError("date cannot be null or undefined");
3489
3491
  }
3490
3492
  // 判断是否是日期对象
3491
3493
  if (!isDate(date)) {
3492
- console.error("Not a Date type!");
3493
- return "";
3494
+ throw new TypeError(`invalid input type: ${typeof date}, expected Date object`);
3494
3495
  }
3495
3496
  // 日期转化替换
3496
3497
  const replaceRules = {
@@ -8392,10 +8393,10 @@
8392
8393
  exports.testLoaded = testLoaded;
8393
8394
  exports.throttle = throttle;
8394
8395
  exports.toCamelCase = toCamelCase;
8395
- exports.toDataUTCString = toDataUTCString;
8396
8396
  exports.toDate = toDate;
8397
8397
  exports.toDateString = toDateString;
8398
8398
  exports.toDateUTC = toDateUTC;
8399
+ exports.toDateUTCString = toDateUTCString;
8399
8400
  exports.toDecimal = toDecimal;
8400
8401
  exports.toFixed = toFixed;
8401
8402
  exports.toKebabCase = toKebabCase;