Skip to content

Commit

Permalink
Handle null/undefined date values (#1866)
Browse files Browse the repository at this point in the history
Fixes #1860
  • Loading branch information
Swahvay authored Dec 27, 2024
1 parent aa049d5 commit 3b1c805
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions ts/src/schema/field.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { DateTime } from "luxon";
import { isPromise } from "util/types";
import { validate } from "uuid";
import { Ent, WriteOperation } from "../core/base";
import { Builder } from "../action/action";
import { Ent, WriteOperation } from "../core/base";
import DB, { Dialect } from "../core/db";
import { __getGlobalSchemaField } from "../core/global_schema";
import { log } from "../core/logger";
import { toFieldName } from "../names/names";
import {
DBType,
Field,
Expand All @@ -13,9 +16,6 @@ import {
PolymorphicOptions,
Type,
} from "./schema";
import { __getGlobalSchemaField } from "../core/global_schema";
import { log } from "../core/logger";
import { toFieldName } from "../names/names";

export abstract class BaseField {
name: string;
Expand Down Expand Up @@ -584,7 +584,7 @@ export class DateField extends BaseField implements Field {
type: Type = { dbType: DBType.Date };

format(val: any): any {
if (typeof val === "string") {
if (typeof val === "string" || val === null || val === undefined) {
return val;
}
val = new Date(val);
Expand Down

0 comments on commit 3b1c805

Please sign in to comment.