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