Skip to content

maxDate option not working properly #507

Description

@sorinsfirlogea

Description
The maxDate option does not seem to work properly when using a overrideDateFormat.

HTML

<input type="text" id="invoice_date_label" data-role="datebox" data-datebox-mode="datebox" class="form-control" value="24.01.2022" />
<input type="hidden" id="invoice_date" name="invoice_date" value="2022-01-24" />

Javascript

var elem = "#invoice_date_label";
var linkedField = elem.replace( '_label', '' );`

$(elem).datebox({
      mode: "datebox",
      controlWidth: '220px',
      overrideHeaderFormat: '%A, %d %b %Y',
      useButton: true,
      useFocus: false,
      overrideDateFieldOrder: ['d', 'm', 'y'],
      overrideDateFormat: '%d.%m.%Y',
      theme_modalContainer: 'bg-light border border-dark m-0 rounded',
      theme_openButton: 'primary-light',
      theme_closeBtn: ['check', 'primary'],
      linkedField: [{id: linkedField, format: '%Y-%m-%d'}]
    });
$(elem).datebox({maxDate: '24.01.2022'});

Behavior
Although it shouldn't, in the above context the maxDate limit allows to select the date of 25.01.2022, then it starts working as it should. On the contrary, when overrideDateFormat is removed and the values of the HTML element (input_date_label) and the maxDate option are changed to ISO standard (YYYY-MM-DD), the limit works properly.

image
image

Desktop:

  • OS: Kubuntu 20.04
  • Browser any

DateBox Details

  • Datebox Version: 5.3.3.
  • Framework w/ Version: Bootstrap 4.6
  • Mode of Operation: DateBox
  • jQuery: 3.6.0

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions