forge-sql-orm 2.0.29 → 2.0.30

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.
@@ -10,17 +10,18 @@ const table = require("drizzle-orm/table");
10
10
  const parseDateTime = (value, format) => {
11
11
  let result;
12
12
  if (value instanceof Date) {
13
- return value;
14
- }
15
- const dt = luxon.DateTime.fromFormat(value, format);
16
- if (dt.isValid) {
17
- result = dt.toJSDate();
13
+ result = value;
18
14
  } else {
19
- const isoDt = luxon.DateTime.fromISO(value);
20
- if (isoDt.isValid) {
21
- result = isoDt.toJSDate();
15
+ const dt = luxon.DateTime.fromFormat(value, format);
16
+ if (dt.isValid) {
17
+ result = dt.toJSDate();
22
18
  } else {
23
- result = new Date(value);
19
+ const isoDt = luxon.DateTime.fromISO(value);
20
+ if (isoDt.isValid) {
21
+ result = isoDt.toJSDate();
22
+ } else {
23
+ result = new Date(value);
24
+ }
24
25
  }
25
26
  }
26
27
  if (isNaN(result.getTime())) {
@@ -1202,7 +1203,7 @@ const forgeDateTimeString = mysqlCore.customType({
1202
1203
  return "datetime";
1203
1204
  },
1204
1205
  toDriver(value) {
1205
- return luxon.DateTime.fromJSDate(value).toFormat("yyyy-LL-dd'T'HH:mm:ss.SSS");
1206
+ return luxon.DateTime.fromJSDate(new Date(value)).toFormat("yyyy-LL-dd'T'HH:mm:ss.SSS");
1206
1207
  },
1207
1208
  fromDriver(value) {
1208
1209
  const format = "yyyy-LL-dd'T'HH:mm:ss.SSS";