Skip to content

Commit

Permalink
Adds Limitations
Browse files Browse the repository at this point in the history
  • Loading branch information
heiglandreas committed Oct 11, 2016
1 parent e41c602 commit b0b9eff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions README.md
Expand Up @@ -32,6 +32,21 @@ comparison-functions in PHP use. When the first value is smaller than the second
returns -1, if the first is greater than the second it returns 1 and when both are
equals it returns 0. The method can therefore be used as callback to sort arrays.

## Caveat/Limitations

Take care! DateIntervals can be nasty!

Due to their nature DateIntervals do *not* take Date or Time into account! So
```DateInterval('P1M')``` might or might not be the same as ```DateInterval('P30D')```!
This Library will compare on a "same entity"-level. So first years are compared,
then months, then weeks and so on. Whewn you have an interval that is descibing only 55 weeks
and compare that to one that is only describing one year, the one year will be considered greater
even though 55 weeks are more. So you should only compare comparable intervals!

The same can happen with f.e. ```new DateInterval('PT36H')``` and ```new DateInterval('P1DT12H')```
You'd think they are the same, but consider DaylightSavingsTime and they suddenly
might not be the same! So currently the ```P1DT12H``` would be considered the "higher" one.

## License

This library is published under the MIT-License. Find a copy in the LICENSE.md-File.

0 comments on commit b0b9eff

Please sign in to comment.