MCPcopy
hub / github.com/flatpickr/flatpickr / minMaxDateSetter

Function minMaxDateSetter

src/index.ts:1953–1991  ·  view source on GitHub ↗
(type: "min" | "max")

Source from the content-addressed store, hash-verified

1951 }
1952
1953 function minMaxDateSetter(type: "min" | "max") {
1954 return (date: DateOption) => {
1955 const dateObj = (self.config[
1956 `_${type}Date` as "_minDate" | "_maxDate"
1957 ] = self.parseDate(date, self.config.dateFormat));
1958
1959 const inverseDateObj =
1960 self.config[
1961 `_${type === "min" ? "max" : "min"}Date` as "_minDate" | "_maxDate"
1962 ];
1963
1964 if (dateObj !== undefined) {
1965 self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] =
1966 (dateObj as Date).getHours() > 0 ||
1967 (dateObj as Date).getMinutes() > 0 ||
1968 (dateObj as Date).getSeconds() > 0;
1969 }
1970
1971 if (self.selectedDates) {
1972 self.selectedDates = self.selectedDates.filter((d) => isEnabled(d));
1973 if (!self.selectedDates.length && type === "min")
1974 setHoursFromDate(dateObj);
1975 updateValue();
1976 }
1977
1978 if (self.daysContainer) {
1979 redraw();
1980
1981 if (dateObj !== undefined)
1982 self.currentYearElement[type] = dateObj.getFullYear().toString();
1983 else self.currentYearElement.removeAttribute(type);
1984
1985 self.currentYearElement.disabled =
1986 !!inverseDateObj &&
1987 dateObj !== undefined &&
1988 inverseDateObj.getFullYear() === dateObj.getFullYear();
1989 }
1990 };
1991 }
1992
1993 function parseConfig() {
1994 const boolOpts: (keyof Options)[] = [

Callers 1

parseConfigFunction · 0.85

Calls 4

isEnabledFunction · 0.85
setHoursFromDateFunction · 0.85
updateValueFunction · 0.85
redrawFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…