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.

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)
  • $args (array)
    • $args['field_id'] (string): The HTML ID for this field
    • $args['options'] (array): The settings for this field

Examples

Blackout dynamic dates

This example will Blackout the New Years day.

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' ) );
	}

	return $js_options;
}

Hide month and year selectors

Datepicker Inline Format By default, the month and year are displayed in dropdown lists. By using this code, it will allow you to show the month and year in the calendar display header and have users select dates by using the next/previous buttons.

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;
}

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. For example, if you want to set the first day of the week to Sunday, replace the value of 3 with 7.

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 © 2025 Strategy11, LLC. Formidable Forms® is a registered trademark Strategy11, LLC.

    Complete your purchase
    Special offer unlocked.
    Get 55% OFF!
    Complete Purchase
    Join 400,000+ using Formidable Forms to create form-focused solutions fast. Get Formidable Forms