xsd2php-runtime icon indicating copy to clipboard operation
xsd2php-runtime copied to clipboard

Support negative DateInterval

Open calcinai opened this issue 6 years ago • 5 comments

Excuse the misspelled branch name, but the rest is pretty self explanatory!

ps. That file was mostly psr-2, but I see there are a couple of formatting changes that have come through. Let me know if you'd like them out of this PR.

calcinai avatar Jul 19 '19 00:07 calcinai

Hi! Thanks for your contribution!

Are negative date intervals something standardized?

Asking since apparently is not supported by PHP.

goetas avatar Jul 22 '19 14:07 goetas

Reasonable question to ask!

I can’t find a concrete answer, but I’ve encountered it more than once. That, and php’s DateInterval can natively represent a negative interval anyway.

Arguably a duration is a duration, regardless of direction so I can see it both ways. Thoughts?

calcinai avatar Jul 22 '19 19:07 calcinai

There’s been some discussion in other projects too: https://github.com/moment/moment/issues/2408

calcinai avatar Jul 22 '19 20:07 calcinai

Sorry for the long feedback loop, was pretty busy in the last days.

This can be ok in my opinion and thanks for finding other references to this negative interval behaviors.

But for such feature I think we need some tests to ensure does not get removed or broken in the future. Can you please?

goetas avatar Jul 25 '19 07:07 goetas

Yep, sure.

calcinai avatar Jul 25 '19 08:07 calcinai