Docs & Support

Learn about all the Formidable features and get support from our amazing customer success team.

frm_date_field_options

Heads up!
This article contains PHP code and is intended for developers. We offer this code as a courtesy, but don't provide support for code customizations or 3rd party development.

Alter the datepicker options before they are converted to javascript. The filter runs with both date picker libraries, jQuery and Flatpickr. Some options behave differently in each, as noted in the examples. Flatpickr is the default since Formidable Forms 7.0. You can switch libraries in Formidable → Global Settings → General Settings under Date Picker Library.

Usage

add_filter( 'frm_date_field_options', 'my_custom_function', 20, 2 );

Formidable Forms makes advanced site building simple. Launch forms, directories, dashboards, and custom WordPress apps faster than ever before.

Parameters

  • $date_options (array): The date picker settings for this field. The date picker options are in $date_options['options'].
  • $args (array)
    • $args['field_id'] (string): The HTML ID for this field: field_ followed by the field key, such as field_jtumj
    • $args['options'] (array): The settings for this field

Examples

The examples check the date field's key. To find it, open the form builder, click the date field, and look in the Field Key box in its field options.

Blackout dynamic dates

This example blacks out the next New Year's Day. It works with the Flatpickr date picker library, the default since Formidable Forms 7.0. With the jQuery date picker library, it only works when the Datepicker Options add-on is active.

add_filter( 'frm_date_field_options', 'add_blackout_dates', 30, 2 );
function add_blackout_dates( $js_options, $extra ) {
	if ( $extra['field_id'] === 'field_jtumj' ) { // Replace jtumj with your field key
		$js_options['formidable_dates']['datesDisabled'][] = date( 'Y-m-d', strtotime( 'first day of january next year' ) );
	}

	return $js_options;
}

Hide month and year selectors

By default, users pick the month from a dropdown list in the calendar header and change the year in the box next to it. With the jQuery date picker library, the year is a dropdown list too.

Use this code to show the month as text in the calendar header and to remove the year selector. Setting changeMonth to false turns the month dropdown into text. Setting changeYear to false removes the year selector: with Flatpickr the year box is hidden, and with jQuery the year shows as text.

add_filter( 'frm_date_field_options', 'hide_month_and_year', 30, 2 );
function hide_month_and_year( $js_options, $extra ) {
	if ( $extra['field_id'] === 'field_jtumj' ) { // Replace jtumj with your field key
		$js_options['options']['changeMonth'] = false;
		$js_options['options']['changeYear'] = false;
	}

	return $js_options;
}

With the jQuery date picker library, this code shows the month and year as text, with the previous and next arrows.

With the Flatpickr date picker library in Formidable Pro 7.1 or newer, the month shows as text and the year box is hidden. The previous and next arrows stay. Visitors then cannot see the year in the calendar header.

Datepicker - Month as text with previous and next arrows and no year box (Flatpickr)

You can also set only one of them. With only changeMonth set to false, the month shows as text and the year box stays. With only changeYear set to false, the month dropdown stays and the year box is hidden.

Set the first day of the week for all forms

Use this code example to set the first day of the week in the datepicker for all forms. The value is the day number: 0 is Sunday, 1 is Monday, and so on up to 6 for Saturday. For example, if you want to set the first day of the week to Sunday, replace the value of 3 with 0.

add_filter('frm_date_field_options', 'set_start_day_all' );
function set_start_day_all( $options ) {
	$options['options']['firstDay'] = 3;
	return $options;
}

Set the first day of the week for a specific field

Use this code example to set the first day of the week in the datepicker for a specific date field key.

add_filter('frm_date_field_options', 'set_start_day', 10, 2);
function set_start_day( $options, $args ) {
	$target_field_key = 'lyy3w'; // Replace lyy3w with the key of the date field.
	if ( 'field_' . $target_field_key === $args['field_id'] ) {
		$options['options']['firstDay'] = 3;
	}
	return $options;
}
Was this article helpful? *

This article may contain affiliate links. Once in a while, we earn commissions from those links. But we only recommend products we like, with or without commissions.

In this article

    We have a small, but amazing team of dedicated people who are committed to helping you achieve your goals and project requirements.


    Copyright © 2026 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms