Option to disable specific dates via settings

Created on 22 February 2024, 9 months ago
Updated 11 March 2024, 8 months ago

Problem/Motivation

The settings lacks support for disabling specific dates, limiting users' ability to customize date selection. This enhancement aims to address this limitation, providing users with greater control and flexibility over date picking functionality.

Steps to reproduce

In JS drupalSettings or via hook attached settings, the specified disabled dates is not working.

Proposed resolution

Add a feature that allows users to easily disable specific dates. By letting users provide a list of dates they want to disable, we give them more control over which dates can be selected. This enhancement will make it simpler for users to customize their date selection experience according to their needs.

Example via hook:

$js_date_settings = &$form[$field_date]['widget'][0]['value']['#attached']['drupalSettings']['datetimeFlatPickr']['node-field_daterange']['settings'];
$js_date_settings['disable'] = [
        '2024-02-25',
        '2024-02-28',
 ];

Example via drupalSettings:

var datetimeFlatPickrSettings = drupalSettings.datetimeFlatPickr || undefined;
if (datetimeFlatPickrSettings) {
        for (var name in datetimeFlatPickrSettings) {
          drupalSettings.datetimeFlatPickr[name].settings.disable = ['2024-02-24'];
        }
 }
Feature request
Status

Fixed

Version

2.0

Component

Code

Created by

🇵🇭Philippines madelyncruz

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024