Temporal types for Mikro ORM
npm install mikro-orm-temporal

This package provides Mikro ORM types for common
Temporal objects.
The library exports the following types:
- DurationType
- PlainDateType
- PlainDateTimeType
- PlainTimeType
- OffsetDateTimeType
Install via your favorite package manager:
``bash`
npm install mikro-orm-temporalor
pnpm add mikro-orm-temporalor
yarn add mikro-orm-temporal
`ts
import { OffsetDateTimeType } from 'mikro-orm-temporal';
import { Entity, Property } from "@mikro-orm/core";
@Entity()
export class HelloWorld {
@Property({type: OffsetDateTimeType})
public dateTime: Temporal.ZonedDateTime;
}
`
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 INTERVAL in Postgres and as INTEGER (in seconds) on all other platforms.PlainDateTime
- is stored as VARCHAR(19)` on MSSQL, as Tedious introduces timezone issues.