How to use the react-day-picker.ModifiersUtils.dayMatchesModifier function in react-day-picker

To help you get started, we’ve selected a few react-day-picker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github catamphetamine / react-responsive-ui / source / DatePicker.js View on Github external
{
				onChange(undefined)
			}

			return this.setState({ text_value: '' })
		}

		value = trimInvalidPart(value, format)

		const selected_day = parseDate(value, format, noon, utc)

		// If the date input is unparseable,
		// or if it's one of the disabled days,
		// then don't change the selected date.
		if (!selected_day ||
			disabledDays && ModifiersUtils.dayMatchesModifier(selected_day, disabledDays))
		{
			return this.setState({ text_value: value })
		}

		// Call `onChange` only if `value` did actually change
		if (!previous_value || previous_value.getTime() !== selected_day.getTime())
		{
			onChange(selected_day)
		}

		this.setState
		({
			text_value: value
		},
		() => this.calendar && this.calendar.showMonth(selected_day))
	}