mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 04:03:12 +08:00
Type date in RedirectCondition::forBeforeDate as Chronos
This commit is contained in:
@@ -24,6 +24,7 @@ use function max;
|
||||
use function min;
|
||||
use function Shlinkio\Shlink\Core\ArrayUtils\map;
|
||||
use function Shlinkio\Shlink\Core\enumValues;
|
||||
use function Shlinkio\Shlink\Core\normalizeDate;
|
||||
use function sprintf;
|
||||
use function str_pad;
|
||||
use function strlen;
|
||||
@@ -124,8 +125,8 @@ class RedirectRuleHandler implements RedirectRuleHandlerInterface
|
||||
$this->askMandatory('City name to match?', $io),
|
||||
),
|
||||
RedirectConditionType::BEFORE_DATE => RedirectCondition::forBeforeDate(
|
||||
$this->askMandatory('Date to match? (ISO 8601)', $io),
|
||||
)
|
||||
normalizeDate($this->askMandatory('Date to match? (ISO 8601)', $io)),
|
||||
),
|
||||
};
|
||||
|
||||
$continue = $io->confirm('Do you want to add another condition?');
|
||||
|
||||
@@ -19,6 +19,7 @@ use Shlinkio\Shlink\Core\RedirectRule\Model\RedirectConditionType;
|
||||
use Shlinkio\Shlink\Core\ShortUrl\Entity\ShortUrl;
|
||||
use Symfony\Component\Console\Style\StyleInterface;
|
||||
|
||||
use function Shlinkio\Shlink\Core\normalizeDate;
|
||||
use function sprintf;
|
||||
|
||||
#[AllowMockObjectsWithoutExpectations]
|
||||
@@ -189,7 +190,7 @@ class RedirectRuleHandlerTest extends TestCase
|
||||
];
|
||||
yield 'Before date' => [
|
||||
RedirectConditionType::BEFORE_DATE,
|
||||
[RedirectCondition::forBeforeDate('2016-05-01T20:34:16+02:00')],
|
||||
[RedirectCondition::forBeforeDate(normalizeDate('2016-05-01T20:34:16+02:00'))],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user