mikro-orm-temporal
v1.1.1
Published
Temporal types for Mikro ORM
Maintainers
Readme
Temporal for Mikro ORM
This package provides Mikro ORM types for common Temporal objects.
The library exports the following types:
DurationTypePlainDateTypePlainDateTimeTypePlainTimeTypeOffsetDateTimeType
Installation
Install via your favorite package manager:
npm install mikro-orm-temporal
# or
pnpm add mikro-orm-temporal
# or
yarn add mikro-orm-temporalUsage
import { OffsetDateTimeType } from 'mikro-orm-temporal';
import { Entity, Property } from "@mikro-orm/core";
@Entity()
export class HelloWorld {
@Property({type: OffsetDateTimeType})
public dateTime: Temporal.ZonedDateTime;
}Caveats
Due to MikroORM not distinguishing between timestamps with and without timezone and some other quirks, this library makes some assumptions and decisions:
- Durations are stored as
INTERVALin Postgres and asINTEGER(in seconds) on all other platforms. PlainDateTimeis stored asVARCHAR(19)on MSSQL, as Tedious introduces timezone issues.
