Example use case (this is just one instance, I think we have this problem in many other places):
0. Do a clean database setup, make sure that Global options -> Date is set to defaults
1. Go to Activities, enter new Activity adding screen - you'll see Scheduled time being set to now.
2. Go to Administer CiviCRM -> Global options -> Date and change 12 hour date format (%I) to 24 hour date format (%H).
3. Got to Activities adding screen again - you'll see that hour default is not being set or is being set to wrong hour. DISCLAIMER: please do this test BETWEEN midnight and noon PST, this bug doesn't show up in afternoons and evenings. (explained below)
This is a problem with the way we handle default date setting. The code for above example is in CRM/Activities/Form.php, in setDefaultValues() function:
$defaults['scheduled_date_time'] = array( 'Y' => date('Y'),
'M' => date('m'),
'd' => date('d'),
'h' => date('h'),
'i' => $min,
'A' => date('A') );
In the example given above, we're setting 'h' as default for hour field (which is 12-hour format of an hour with leading zeros), but the form is set to use 'H' (which is 24-hour format of an hour with leading zeros). The effect is probably always displaying hours from 0am to 12pm only.
- We can create a function in CRM_Utils_Date which - given specific date (or no arguments for now) will return proper defaults array based on date format configuration. This change will need to be incorporated in all the places where we set default date in form.