Silverstripe 日历选择器不显示过去的日期
Silverstripe calendar picker to not show past dates
有没有办法将 Silverstripe 中的日历选择器设置为无法select 过去的日期?
据我所知,它使用 jQuery DatePicker,但我不确定如何限制过去的日期。
DateField::create("Date","Date")
->setAttribute('placeholder','eg 2017-01-01')
->setConfig('showcalendar', true),
您可以将配置选项传递给日期选择器:
DateField::create("Date","Date")
->setConfig('showcalendar', true)
->setConfig('min', date('Y-m-d'))
->setDescription('')
->setAttribute('data-number-of-months', 3);
->setConfig('min', date('Y-m-d'))
告诉 jQueryUI 选择器使用最小日期(今天)。使用数据属性,您还可以将其他配置传递给选择器,在上述情况下,它一次显示三个月。这将传递给日期选择器配置。
请注意,日期选择器驼峰式配置 "numberOfMonths" 必须使用连字符编写,例如 'data-number-of-months'。
有没有办法将 Silverstripe 中的日历选择器设置为无法select 过去的日期?
据我所知,它使用 jQuery DatePicker,但我不确定如何限制过去的日期。
DateField::create("Date","Date")
->setAttribute('placeholder','eg 2017-01-01')
->setConfig('showcalendar', true),
您可以将配置选项传递给日期选择器:
DateField::create("Date","Date")
->setConfig('showcalendar', true)
->setConfig('min', date('Y-m-d'))
->setDescription('')
->setAttribute('data-number-of-months', 3);
->setConfig('min', date('Y-m-d'))
告诉 jQueryUI 选择器使用最小日期(今天)。使用数据属性,您还可以将其他配置传递给选择器,在上述情况下,它一次显示三个月。这将传递给日期选择器配置。
请注意,日期选择器驼峰式配置 "numberOfMonths" 必须使用连字符编写,例如 'data-number-of-months'。