Skip to content

Default date without automatically setting value #992

@RinkAttendant6

Description

@RinkAttendant6

I'm wondering if there is a better way to initialize the plugin to a certain date (like defaultDate) but without it auto-populating the field. Currently I'm doing it like this:

<input type="text" class='form-control' id='dob' name='birth_date' placeholder="aaaa-mm-jj" data-allow-input='true' data-max-date='today' data-default-date='2002-08-20' required>
flatpickr('#dob', {
    onReady() {
        this.input.value = '';
    }
});

As this is a date of birth field, I'd like to start the calendar at 15 years ago since nearly all of our users are age 15+ (the value in the HTML is dynamically generated on server-side render). However I do not want the field to be populated with that date upon page load/instantiation.

Your Environment

  • flatpickr version used: 3.0.7
  • Browser name and version: Chrome 60
  • OS and version: Linux Mint 18.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions