@anjianshi/utils 2.9.0 → 2.9.1

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anjianshi/utils",
3
- "version": "2.9.0",
3
+ "version": "2.9.1",
4
4
  "description": "Common JavaScript Utils",
5
5
  "homepage": "https://github.com/anjianshi/js-packages/utils",
6
6
  "bugs": {
@@ -33,10 +33,10 @@
33
33
  "vconsole": "^3.15.1",
34
34
  "@anjianshi/presets-eslint-base": "6.0.0",
35
35
  "@anjianshi/presets-eslint-react": "6.0.0",
36
- "@anjianshi/presets-prettier": "3.0.4",
37
- "@anjianshi/presets-typescript": "3.2.4",
36
+ "@anjianshi/presets-eslint-node": "6.0.0",
38
37
  "@anjianshi/presets-eslint-typescript": "6.0.0",
39
- "@anjianshi/presets-eslint-node": "6.0.0"
38
+ "@anjianshi/presets-prettier": "3.0.4",
39
+ "@anjianshi/presets-typescript": "3.2.4"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.14.0",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 验证日期时间类型的值,依赖 dayjs
3
3
  */
4
- import { Dayjs } from 'dayjs';
4
+ import { type Dayjs } from 'dayjs';
5
5
  import { type CommonOptions } from './base.js';
6
6
  export interface DatetimeOptions extends CommonOptions<number> {
7
7
  dayjs?: boolean;
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 验证日期时间类型的值,依赖 dayjs
3
3
  */
4
- import dayjs, { Dayjs } from 'dayjs';
4
+ import dayjs from 'dayjs';
5
5
  import { success, failed } from '../lang/index.js';
6
6
  import { getValidatorGenerator } from './base.js';
7
7
  export function getDatetimeValidator(options = {}) {
@@ -17,7 +17,7 @@ export function getDatetimeValidator(options = {}) {
17
17
  if (!dayjsValue.isValid())
18
18
  return failed(`${field} must be a valid datetime string`);
19
19
  }
20
- else if (value instanceof Date || value instanceof Dayjs) {
20
+ else if (value instanceof Date || dayjs.isDayjs(value)) {
21
21
  dayjsValue = dayjs(value);
22
22
  if (!dayjsValue.isValid())
23
23
  return failed(`${field} must be a valid Date or Dayjs object`);