Foundation icon indicating copy to clipboard operation
Foundation copied to clipboard

PgInterval error

Open chanmix51 opened this issue 9 years ago • 5 comments

Data 'PT-11H-26M-27.454181S' is not an ISO8601 interval representation.

chanmix51 avatar Mar 02 '15 11:03 chanmix51

Php does not comply IS08601 at 100%

https://github.com/pomm-project/Foundation/blob/master/sources/tests/Unit/Converter/PgInterval.php#L24

stood avatar Mar 03 '15 07:03 stood

Yes, it seems PHP is lacking the representation of negative intervals. Even though there is a invert flag, it makes the PgInterval to store the absolute value and adds a negative sign at the end. This does not make PHP able to support interval representations like 2 days - 2 hours which Postgresql supports.

This is a PHP issue, not a Pomm issue. Maybe it is somehow interesting to find a solution to have a fallback in case of such issue.

chanmix51 avatar Mar 03 '15 08:03 chanmix51

Hello, I encounter this issue a lot in my use case :/ I understand the bug come from php, but do you have any idea of a workaround I could implement? Thank you <3

krichprollsch avatar Sep 15 '17 17:09 krichprollsch

What can be done from our side, is to support any classes that inherits from DateInterval. This way, you could implement your own DateInteval class that would feature negative date intervals.

chanmix51 avatar Sep 15 '17 17:09 chanmix51

I have this issue in few places. I do date_trunc('second', field) to ensure there will be no floating point time. It's a dirty hack but until PHP implement it we can't do a lot more.

zecho avatar Oct 03 '17 12:10 zecho