@mikro-orm/knex 6.2.8-dev.0 → 6.2.8-dev.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.
@@ -240,6 +240,7 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
240
240
  const targetProps = ref
241
241
  ? meta2.getPrimaryProps()
242
242
  : meta2.props.filter(prop => this.platform.shouldHaveColumn(prop, hint.children || []));
243
+ const tz = this.platform.getTimezone();
243
244
  for (const prop of targetProps) {
244
245
  if (prop.fieldNames.length > 1) { // composite keys
245
246
  const fk = prop.fieldNames.map(name => root[`${relationAlias}__${name}`]);
@@ -248,8 +249,16 @@ class AbstractSqlDriver extends core_1.DatabaseDriver {
248
249
  }
249
250
  else if (prop.runtimeType === 'Date') {
250
251
  const alias = `${relationAlias}__${prop.fieldNames[0]}`;
251
- const type = typeof root[alias];
252
- relationPojo[prop.name] = (['string', 'number'].includes(type) ? this.platform.parseDate(root[alias]) : root[alias]);
252
+ const value = root[alias];
253
+ if (tz && tz !== 'local' && typeof value === 'string' && !value.includes('+') && !value.endsWith('Z')) {
254
+ relationPojo[prop.name] = this.platform.parseDate(value + tz);
255
+ }
256
+ else if (['string', 'number'].includes(typeof value)) {
257
+ relationPojo[prop.name] = this.platform.parseDate(value);
258
+ }
259
+ else {
260
+ relationPojo[prop.name] = value;
261
+ }
253
262
  }
254
263
  else {
255
264
  const alias = `${relationAlias}__${prop.fieldNames[0]}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mikro-orm/knex",
3
- "version": "6.2.8-dev.0",
3
+ "version": "6.2.8-dev.1",
4
4
  "description": "TypeScript ORM for Node.js based on Data Mapper, Unit of Work and Identity Map patterns. Supports MongoDB, MySQL, PostgreSQL and SQLite databases as well as usage with vanilla JavaScript.",
5
5
  "main": "index.js",
6
6
  "module": "index.mjs",
@@ -66,6 +66,6 @@
66
66
  "@mikro-orm/core": "^6.2.7"
67
67
  },
68
68
  "peerDependencies": {
69
- "@mikro-orm/core": "6.2.8-dev.0"
69
+ "@mikro-orm/core": "6.2.8-dev.1"
70
70
  }
71
71
  }