@nocobase/database 1.4.0-alpha.20241016084738 → 1.4.0-alpha.20241020025811

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.
@@ -49,21 +49,26 @@ function isDate(input) {
49
49
  __name(isDate, "isDate");
50
50
  const toDate = /* @__PURE__ */ __name((date, options = {}) => {
51
51
  const { ctx } = options;
52
- const val = isDate(date) ? date : new Date(date);
52
+ let val = isDate(date) ? date : new Date(date);
53
53
  const field = ctx.db.getFieldByPath(ctx.fieldPath);
54
54
  if (!field) {
55
55
  return val;
56
56
  }
57
57
  if (field.constructor.name === "UnixTimestampField") {
58
- return field.dateToValue(val);
58
+ val = field.dateToValue(val);
59
59
  }
60
60
  if (field.constructor.name === "DatetimeNoTzField") {
61
- return (0, import_moment.default)(val).utcOffset("+00:00").format("YYYY-MM-DD HH:mm:ss");
61
+ val = (0, import_moment.default)(val).utcOffset("+00:00").format("YYYY-MM-DD HH:mm:ss");
62
62
  }
63
63
  if (field.constructor.name === "DateOnlyField") {
64
- return (0, import_moment.default)(val).format("YYYY-MM-DD HH:mm:ss");
64
+ val = (0, import_moment.default)(val).format("YYYY-MM-DD HH:mm:ss");
65
65
  }
66
- return val;
66
+ const eventObj = {
67
+ val,
68
+ fieldType: field.type
69
+ };
70
+ ctx.db.emit("filterToDate", eventObj);
71
+ return eventObj.val;
67
72
  }, "toDate");
68
73
  function parseDateTimezone(ctx) {
69
74
  const field = ctx.db.getFieldByPath(ctx.fieldPath);
@@ -79,10 +84,6 @@ function parseDateTimezone(ctx) {
79
84
  return ctx.db.options.timezone;
80
85
  }
81
86
  __name(parseDateTimezone, "parseDateTimezone");
82
- function isDatetimeString(str) {
83
- return /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/.test(str);
84
- }
85
- __name(isDatetimeString, "isDatetimeString");
86
87
  var date_default = {
87
88
  $dateOn(value, ctx) {
88
89
  const r = (0, import_utils.parseDate)(value, {
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "1.4.0-alpha.20241016084738",
3
+ "version": "1.4.0-alpha.20241020025811",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "AGPL-3.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "1.4.0-alpha.20241016084738",
10
- "@nocobase/utils": "1.4.0-alpha.20241016084738",
9
+ "@nocobase/logger": "1.4.0-alpha.20241020025811",
10
+ "@nocobase/utils": "1.4.0-alpha.20241020025811",
11
11
  "async-mutex": "^0.3.2",
12
12
  "chalk": "^4.1.1",
13
13
  "cron-parser": "4.4.0",
@@ -38,5 +38,5 @@
38
38
  "url": "git+https://github.com/nocobase/nocobase.git",
39
39
  "directory": "packages/database"
40
40
  },
41
- "gitHead": "01d1423c8664a07cf946331659881990def53d1e"
41
+ "gitHead": "22c4d58a897af2661a4c0b48382ae17b1d61077e"
42
42
  }