@nocobase/utils 1.7.18 → 1.7.19
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/date.d.ts +1 -0
- package/lib/date.js +5 -2
- package/lib/parse-filter.js +3 -0
- package/package.json +2 -2
package/lib/date.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface Str2momentOptions {
|
|
|
12
12
|
picker?: 'year' | 'month' | 'week' | 'quarter';
|
|
13
13
|
utcOffset?: number;
|
|
14
14
|
utc?: boolean;
|
|
15
|
+
dateOnly?: boolean;
|
|
15
16
|
}
|
|
16
17
|
export type Str2momentValue = string | string[] | dayjs.Dayjs | dayjs.Dayjs[];
|
|
17
18
|
export interface GetDefaultFormatProps {
|
package/lib/date.js
CHANGED
|
@@ -102,10 +102,13 @@ const toMoment = /* @__PURE__ */ __name((val, options) => {
|
|
|
102
102
|
return;
|
|
103
103
|
}
|
|
104
104
|
const offset = options.utcOffset;
|
|
105
|
-
const { gmt, picker, utc = true } = options;
|
|
105
|
+
const { gmt, picker, utc = true, dateOnly } = options;
|
|
106
106
|
if ((0, import_dayjs.dayjs)(val).isValid()) {
|
|
107
|
+
if (dateOnly) {
|
|
108
|
+
return import_dayjs.dayjs.utc(val, "YYYY-MM-DD");
|
|
109
|
+
}
|
|
107
110
|
if (!utc) {
|
|
108
|
-
return
|
|
111
|
+
return import_dayjs.dayjs.utc(val);
|
|
109
112
|
}
|
|
110
113
|
if (import_dayjs.dayjs.isDayjs(val)) {
|
|
111
114
|
return offset ? val.utcOffset(offsetFromString(offset)) : val;
|
package/lib/parse-filter.js
CHANGED
|
@@ -196,6 +196,9 @@ const parseFilter = /* @__PURE__ */ __name(async (filter, opts = {}) => {
|
|
|
196
196
|
if (isDateOperator(operator)) {
|
|
197
197
|
const field = getField == null ? void 0 : getField(path);
|
|
198
198
|
if ((field == null ? void 0 : field.constructor.name) === "DateOnlyField" || (field == null ? void 0 : field.constructor.name) === "DatetimeNoTzField") {
|
|
199
|
+
if (value.type) {
|
|
200
|
+
return (0, import_dateRangeUtils.getDayRangeByParams)({ ...value, timezone: (field == null ? void 0 : field.timezone) || timezone });
|
|
201
|
+
}
|
|
199
202
|
return value;
|
|
200
203
|
}
|
|
201
204
|
return dateValueWrapper(value, (field == null ? void 0 : field.timezone) || timezone);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/utils",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.19",
|
|
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": "
|
|
19
|
+
"gitHead": "39992983a40047432e6582623b996ba23b51ef5a"
|
|
20
20
|
}
|