simpod/doctrine-utcdatetime

Doctrine UTC DateTime

Fund package maintenance!
simPod

0.3.0 2024-02-04 13:42 UTC

This package is auto-updated.

Last update: 2024-09-27 09:17:24 UTC


README

GitHub Actions Code Coverage Downloads Packagist

Contains DateTime and DateTimeImmutable Doctrine DBAL types that store datetimes in UTC timezone (TIMESTAMP type in postgres).

For more detailed explanation see Doctrine ORM docs and this comment.

For more info about usage in Doctrine ORM see Doctrine documentation. The code is mostly copied from there.

Using the UTCDateTimeType

Installation

composer require simpod/doctrine-utcdatetime

Overriding default types in Symfony

Simply copied from DoctrineExtensions' documentation:

doctrine:
    dbal:
        types:
            datetime: SimPod\DoctrineUtcDateTime\UTCDateTimeType
            datetimetz: SimPod\DoctrineUtcDateTime\UTCDateTimeType
            datetime_immutable: SimPod\DoctrineUtcDateTime\UTCDateTimeImmutableType
            datetimetz_immutable: SimPod\DoctrineUtcDateTime\UTCDateTimeImmutableType