Skip to content

Commit eaa2d89

Browse files
committed
fix(Sharing): Improve date error messages
Signed-off-by: provokateurin <kate@provokateurin.de>
1 parent af8c47a commit eaa2d89

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

lib/public/Sharing/Property/ADateSharePropertyType.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,17 @@ public function validateValue(IFactory $l10nFactory, Share $share, string $value
4646
}
4747

4848
if ($date === false) {
49-
return $l10nFactory->get(Application::APP_ID)->t('Invalid ISO date: %s', [$value]);
49+
return $l10nFactory->get(Application::APP_ID)->t('Invalid ISO8601 date: %s', [$value]);
5050
}
5151

5252
if (($minDate = $this->getMinDate($share)) instanceof DateTimeImmutable && $date->diff($minDate)->invert === 0) {
53-
return $l10nFactory->get(Application::APP_ID)->t('Date needs to be after %1$s: %2$s', [$minDate->format(DateTimeInterface::ATOM), $value]);
53+
$l10n = $l10nFactory->get(Application::APP_ID);
54+
return $l10n->t('Date needs to be after %s', [$l10n->l('datetime', $minDate)]);
5455
}
5556

5657
if (($maxDate = $this->getMaxDate($share)) instanceof DateTimeImmutable && $date->diff($maxDate)->invert === 1) {
57-
return $l10nFactory->get(Application::APP_ID)->t('Date needs to be before %1$s: %2$s', [$maxDate->format(DateTimeInterface::ATOM), $value]);
58+
$l10n = $l10nFactory->get(Application::APP_ID);
59+
return $l10n->t('Date needs to be before %s', [$l10n->l('datetime', $maxDate)]);
5860
}
5961

6062
return true;

0 commit comments

Comments
 (0)