@nocobase/utils 1.7.19 → 1.7.20

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.
Files changed (2) hide show
  1. package/lib/date.js +4 -1
  2. package/package.json +2 -2
package/lib/date.js CHANGED
@@ -105,7 +105,10 @@ const toMoment = /* @__PURE__ */ __name((val, options) => {
105
105
  const { gmt, picker, utc = true, dateOnly } = options;
106
106
  if ((0, import_dayjs.dayjs)(val).isValid()) {
107
107
  if (dateOnly) {
108
- return import_dayjs.dayjs.utc(val, "YYYY-MM-DD");
108
+ const date = (0, import_dayjs.dayjs)(val);
109
+ if (!date.isValid()) return val;
110
+ const dateString = date.format("YYYY-MM-DD");
111
+ return import_dayjs.dayjs.utc(dateString, "YYYY-MM-DD");
109
112
  }
110
113
  if (!utc) {
111
114
  return import_dayjs.dayjs.utc(val);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/utils",
3
- "version": "1.7.19",
3
+ "version": "1.7.20",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib/index.d.ts",
6
6
  "license": "AGPL-3.0",
@@ -16,5 +16,5 @@
16
16
  "multer": "^1.4.5-lts.2",
17
17
  "object-path": "^0.11.8"
18
18
  },
19
- "gitHead": "39992983a40047432e6582623b996ba23b51ef5a"
19
+ "gitHead": "8a8257c29bf03d93ea0e5ad7e4c5e44d31c2d89c"
20
20
  }