mikro-orm/mikro-orm

View on GitHub
packages/core/src/types/DateTimeType.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
import { Type } from './Type';
import type { Platform } from '../platforms';
import type { EntityProperty } from '../typings';

export class DateTimeType extends Type<Date, string> {

  override getColumnType(prop: EntityProperty, platform: Platform): string {
    return platform.getDateTimeTypeDeclarationSQL({ length: prop.length });
  }

  override compareAsType(): string {
    return 'Date';
  }

  override get runtimeType(): string {
    return 'Date';
  }

  override ensureComparable(): boolean {
    return false;
  }

}