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
minDate and maxDate for jQuery date #384
Comments
You can override those options by defining "minDate" and "maxDate" in the 'configs' when creating your field :
|
Yes - You can overwrite minDate and maxDate, but only by using numeric offset like -20, or string of periods and units like "+2M +4D", but not by passing a date, since in the template there is this thing: It means, that if You set it like bellow it won't work: class MyFormType {
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('my_date', 'genemu_jquerydate', [
'widget' => 'single_text',
'label' => 'publisher.poll.closing_date',
'format' => $format,
'configs' => [
'minDate' => new \DateTime(),
'maxDate' => "any string representing valid date",
],
'required' => false,
]);
}
} I think that json_encode twig filter (which is actually regular PHP json_decode function) should be replaced with a custom one which will check if minDate/maxDate are date object, and then it'll create javascript Date() from it... |
I've tried to use jquery datetime plugin on my application and I could not configure the initial and final date from calendar that was showing.
After spend a little time looking for solution, I've opened widget template and found it:
And the template:
So, this is my point: why
minDate: new Date({{ min_year }}, 0, 1)
andmaxDate: new Date({{ max_year }}, 11, 31)
are hardcode?The text was updated successfully, but these errors were encountered: