@nocobase/database 2.1.0-alpha.26 → 2.1.0-alpha.27

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.
@@ -47,6 +47,14 @@ function isDate(input) {
47
47
  return input instanceof Date || Object.prototype.toString.call(input) === "[object Date]";
48
48
  }
49
49
  __name(isDate, "isDate");
50
+ function isDatetimeNoTzField(field) {
51
+ return (field == null ? void 0 : field.type) === "datetimeNoTz" || (field == null ? void 0 : field.constructor.name) === "DatetimeNoTzField";
52
+ }
53
+ __name(isDatetimeNoTzField, "isDatetimeNoTzField");
54
+ function isDateOnlyField(field) {
55
+ return (field == null ? void 0 : field.type) === "dateOnly" || (field == null ? void 0 : field.constructor.name) === "DateOnlyField";
56
+ }
57
+ __name(isDateOnlyField, "isDateOnlyField");
50
58
  const toDate = /* @__PURE__ */ __name((date, options = {}) => {
51
59
  const { ctx } = options;
52
60
  let val = isDate(date) ? date : new Date(date);
@@ -57,10 +65,10 @@ const toDate = /* @__PURE__ */ __name((date, options = {}) => {
57
65
  if (field.constructor.name === "UnixTimestampField") {
58
66
  val = field.dateToValue(val);
59
67
  }
60
- if (field.constructor.name === "DatetimeNoTzField") {
68
+ if (isDatetimeNoTzField(field)) {
61
69
  val = (0, import_moment.default)(val).utcOffset("+00:00").format("YYYY-MM-DD HH:mm:ss");
62
70
  }
63
- if (field.constructor.name === "DateOnlyField") {
71
+ if (isDateOnlyField(field)) {
64
72
  val = import_moment.default.utc(val).format("YYYY-MM-DD HH:mm:ss");
65
73
  }
66
74
  const eventObj = {
@@ -75,10 +83,10 @@ function parseDateTimezone(ctx) {
75
83
  if (!field) {
76
84
  return ctx.db.options.timezone;
77
85
  }
78
- if (field.constructor.name === "DatetimeNoTzField") {
86
+ if (isDatetimeNoTzField(field)) {
79
87
  return "+00:00";
80
88
  }
81
- if (field.constructor.name === "DateOnlyField") {
89
+ if (isDateOnlyField(field)) {
82
90
  return "+00:00";
83
91
  }
84
92
  return ctx.db.options.timezone;
package/package.json CHANGED
@@ -1,13 +1,13 @@
1
1
  {
2
2
  "name": "@nocobase/database",
3
- "version": "2.1.0-alpha.26",
3
+ "version": "2.1.0-alpha.27",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
7
  "license": "Apache-2.0",
8
8
  "dependencies": {
9
- "@nocobase/logger": "2.1.0-alpha.26",
10
- "@nocobase/utils": "2.1.0-alpha.26",
9
+ "@nocobase/logger": "2.1.0-alpha.27",
10
+ "@nocobase/utils": "2.1.0-alpha.27",
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": "e6e6518030175b58080218bb4357642398bcb54a"
41
+ "gitHead": "a340a88d86d3ff7e06d723215b02aa3c122f4870"
42
42
  }