Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

\Safe\DateTimeImmutable comparison not correct #179

Closed
kunicmarko20 opened this issue Jan 6, 2020 · 1 comment
Closed

\Safe\DateTimeImmutable comparison not correct #179

kunicmarko20 opened this issue Jan 6, 2020 · 1 comment

Comments

@kunicmarko20
Copy link
Contributor

kunicmarko20 commented Jan 6, 2020

<?php

require_once __DIR__.'/vendor/autoload.php';

$timeLimit = \DateInterval::createFromDateString('2 hours');

$safeDateTime = new \Safe\DateTimeImmutable();
$phpDateTime = new \DateTimeImmutable();

\var_dump($safeDateTime->modify('+3 hours') < $safeDateTime->add($timeLimit)); // true
\var_dump($phpDateTime->modify('+3 hours') < $phpDateTime->add($timeLimit)); // false

Given this snippet, I would expect that both are false, but when using \Safe\DateTimeImmutable I am getting true.

@kunicmarko20
Copy link
Contributor Author

Fixed #180

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant