Skip to main content
added 477 characters in body
Source Link
Demerit
  • 24.7k
  • 2
  • 12
  • 34

DidOn an older version you trycan use the prefs for activityDateTime? It worked for me. The code appears to useuses the same setting as for activityDateTime under Administer - Customize Data and Screens - Date Preferences. The line of code that creates the widget looks like this:

$this->addDateTime('start_date', ts('Start Date'), FALSE, array('formatType' => 'activityDateTime'));

which tells the form system to use the prefs for activityDateTime.

If you're on a more recent version of CiviCRM the widget has changed and there doesn't seem to be a pref. Temporarily you can edit the file CRM/Event/Form/ManageEvent/EventInfo.php and change the line that says this (around line 177)

$this->add('datepicker', 'start_date', ts('Start'), [], !$this->_isTemplate, ['time' => TRUE]);

to this:

$this->add('datepicker', 'start_date', ts('Start'), [], !$this->_isTemplate, ['time' => TRUE, 'yearRange' => '-50:+50']);

See also https://docs.civicrm.org/dev/en/latest/framework/ui/#date-picker

Did you try the prefs for activityDateTime? It worked for me. The code appears to use the same setting as for activityDateTime under Administer - Customize Data and Screens - Date Preferences. The line of code that creates the widget looks like this:

$this->addDateTime('start_date', ts('Start Date'), FALSE, array('formatType' => 'activityDateTime'));

which tells the form system to use the prefs for activityDateTime.

On an older version you can use the prefs for activityDateTime. The code uses the same setting as for activityDateTime under Administer - Customize Data and Screens - Date Preferences. The line of code that creates the widget looks like this:

$this->addDateTime('start_date', ts('Start Date'), FALSE, array('formatType' => 'activityDateTime'));

which tells the form system to use the prefs for activityDateTime.

If you're on a more recent version of CiviCRM the widget has changed and there doesn't seem to be a pref. Temporarily you can edit the file CRM/Event/Form/ManageEvent/EventInfo.php and change the line that says this (around line 177)

$this->add('datepicker', 'start_date', ts('Start'), [], !$this->_isTemplate, ['time' => TRUE]);

to this:

$this->add('datepicker', 'start_date', ts('Start'), [], !$this->_isTemplate, ['time' => TRUE, 'yearRange' => '-50:+50']);

See also https://docs.civicrm.org/dev/en/latest/framework/ui/#date-picker

Source Link
Demerit
  • 24.7k
  • 2
  • 12
  • 34

Did you try the prefs for activityDateTime? It worked for me. The code appears to use the same setting as for activityDateTime under Administer - Customize Data and Screens - Date Preferences. The line of code that creates the widget looks like this:

$this->addDateTime('start_date', ts('Start Date'), FALSE, array('formatType' => 'activityDateTime'));

which tells the form system to use the prefs for activityDateTime.