The datepicker fields in WP-CRM System by default are set up in English. However, not all users of the plugin are in English speaking areas. To support this, we have added filters to the plugin to allow you to modify the English words. Additionally, there are filters that can modify the behavior of the datepicker fields. For example, the date format, or if you want to change the months or years.

Here is a complete list of the included filters and their default text. Please note that the datepicker is expecting text to be returned in the same format as what is provided below. So, if the data is in an array, datepicker is expecting that you return an array of the same length (i.e. 7 values for days of the week, or 12 values for months of the year, etc.). True/False values expect to receive one or the other, and no other responses would be valid.

A list of expected responses is provided on the jQuery UI website.

'wpcrm_system_datepicker_append_text'                Default: ''
'wpcrm_system_datepicker_auto_size'                  Default: false
'wpcrm_system_datepicker_button_image'               Default: ''
'wpcrm_system_datepicker_button_image_only'          Default: false
'wpcrm_system_datepicker_change_month'               Default: true
'wpcrm_system_datepicker_change_year'                Default: true
'wpcrm_system_datepicker_close_text'                 Default: 'Done'
'wpcrm_system_datepicker_constrain_input'            Default: true
'wpcrm_system_datepicker_current_text'               Default: 'Today'
'wpcrm_system_datepicker_date_format'                Default: Your WordPress site's date format found in Settings > General
'wpcrm_system_datepicker_day_names'                  Default: array( 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' )
'wpcrm_system_datepicker_day_names_min'              Default: array( 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' )
'wpcrm_system_datepicker_day_names_short'            Default: array( 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' )
'wpcrm_system_datepicker_default_date'               Default: null
'wpcrm_system_datepicker_duration'                   Default: 'normal'
'wpcrm_system_datepicker_first_day'                  Default: 0
'wpcrm_system_datepicker_go_to_current'              Default: false
'wpcrm_system_datepicker_hide_if_no_prev_next'       Default: false
'wpcrm_system_datepicker_is_rtl'                     Default: false
'wpcrm_system_datepicker_max_date'                   Default: null
'wpcrm_system_datepicker_min_date'                   Default: null
'wpcrm_system_datepicker_month_names'                Default: array( 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' )
'wpcrm_system_datepicker_month_names_short'          Default: array( 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' )
'wpcrm_system_datepicker_navigation_as_date_format'  Default: false
'wpcrm_system_datepicker_next_text'                  Default: 'Next'
'wpcrm_system_datepicker_number_of_months'           Default: array( 1, 1 )
'wpcrm_system_datepicker_prevText'                   Default: 'Prev'
'wpcrm_system_datepicker_select_other_months'        Default: false
'wpcrm_system_datepicker_short_year_cutoff'          Default: '+10'
'wpcrm_system_datepicker_show_anim'                  Default: 'show'
'wpcrm_system_datepicker_show_button_panel'          Default: false
'wpcrm_system_datepicker_show_current_at_pos'        Default: 0
'wpcrm_system_datepicker_show_month_after_year'      Default: false
'wpcrm_system_datepicker_show_on'                    Default: 'focus'
'wpcrm_system_datepicker_show_other_months'          Default: false
'wpcrm_system_datepicker_show_week'                  Default: false
'wpcrm_system_datepicker_step_months'                Default: 1
'wpcrm_system_datepicker_week_header'                Default: 'Wk'
'wpcrm_system_datepicker_year_range'                 Default: '1900:2100'
'wpcrm_system_datepicker_year_suffix'                Default: ''

Here are a few examples of how these filters can be used:

// Copy below into your child theme's functions.php or into a custom plugin.

// Change the days of the week to French
add_filter( 'wpcrm_system_datepicker_day_names', 'my_custom_day_names' );
function my_custom_day_names( $days ){
  $new_days = array(
    'Dimanche',
    'Lundi',
    'Mardi',
    'Mercredi',
    'Jeudi',
    'Vendredi',
    'Samedi',
  );
  return $new_days;
}

// Change the first day of the week to Monday = 1 (default is Sunday = 0)
add_filter( 'wpcrm_system_datepicker_first_day', 'my_custom_first_day_of_week' );
function my_custom_first_day_of_week( $day ){
  return 1;
}

// Change the range of years shown (Default is 1900:2100)
add_filter( 'wpcrm_system_datepicker_year_range', 'my_custom_year_range' );
function my_custom_year_range( $range ){
  return '1950:2050';
}

// Change the default date to be 2 days from today
add_filter( 'wpcrm_system_datepicker_default_date', 'my_change_default_date' );
function my_change_default_date( $default ){
  return 2;
}

// Change the date format to Year Month Day (i.e. 2018 01 30)
add_filter( 'wpcrm_system_datepicker_date_format', 'my_custom_date_format' );
function my_custom_date_format( $default ){
  return 'yy mm dd';
}