Skip to content

DateIntervalType (negative support) #2578

@galeaspablo

Description

@galeaspablo

DateIntervalType does not support negative intervals
(http://php.net/manual/en/class.dateinterval.php#dateinterval.props.invert) 😢

Is this an oversight?
It's not in a stable version, so it can still be changed.

Happy to work on a PR.

Edit: Had a look, and saw that it was decided at #854 to not store this as integers, for readability reasons.

N.B. A while ago, @jaroslavtyc created this functionality by using integers, and a DateInterval library. https://github.com/jaroslavtyc/doctrineum-date-interval/blob/master/Doctrineum/DateInterval/DBAL/Types/DateIntervalType.php We could use the same approach.

Edit 2: Or we can add a + or - in front of the stored string.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions