Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

usage in form rules #4

Open
Ciki opened this issue Sep 2, 2021 · 1 comment
Open

usage in form rules #4

Ciki opened this issue Sep 2, 2021 · 1 comment

Comments

@Ciki
Copy link
Contributor

Ciki commented Sep 2, 2021

Hi, how can I use datepicker control in form rule as in example below? The date_from control's getValue() return DateTimeImmutable instance which does not have __toString() implemented thus throws an error in Nette\Forms\Validator::formatMessage()

$form->addDatePicker('date_from', 'Dátum od');
$form->addDatePicker('date_to', 'Dátum do')
  ->addRule($form::RANGE, 'Please select date between %d and %d', [$form['date_from'], new \Nette\Utils\DateTime()]);

Thanks!

@Ciki
Copy link
Contributor Author

Ciki commented Apr 5, 2022

how do you use it? anyone...?

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

No branches or pull requests

1 participant