MCPcopy
hub / github.com/flatpickr/flatpickr / createDay

Function createDay

src/index.ts:679–756  ·  view source on GitHub ↗
(
    className: string,
    date: Date,
    _dayNumber: number,
    i: number
  )

Source from the content-addressed store, hash-verified

677 }
678
679 function createDay(
680 className: string,
681 date: Date,
682 _dayNumber: number,
683 i: number
684 ) {
685 const dateIsEnabled = isEnabled(date, true),
686 dayElement = createElement<DayElement>(
687 "span",
688 className,
689 date.getDate().toString()
690 );
691
692 dayElement.dateObj = date;
693 dayElement.$i = i;
694 dayElement.setAttribute(
695 "aria-label",
696 self.formatDate(date, self.config.ariaDateFormat)
697 );
698
699 if (
700 className.indexOf("hidden") === -1 &&
701 compareDates(date, self.now) === 0
702 ) {
703 self.todayDateElem = dayElement;
704 dayElement.classList.add("today");
705 dayElement.setAttribute("aria-current", "date");
706 }
707
708 if (dateIsEnabled) {
709 dayElement.tabIndex = -1;
710 if (isDateSelected(date)) {
711 dayElement.classList.add("selected");
712 self.selectedDateElem = dayElement;
713
714 if (self.config.mode === "range") {
715 toggleClass(
716 dayElement,
717 "startRange",
718 self.selectedDates[0] &&
719 compareDates(date, self.selectedDates[0], true) === 0
720 );
721
722 toggleClass(
723 dayElement,
724 "endRange",
725 self.selectedDates[1] &&
726 compareDates(date, self.selectedDates[1], true) === 0
727 );
728
729 if (className === "nextMonthDay") dayElement.classList.add("inRange");
730 }
731 }
732 } else {
733 dayElement.classList.add("flatpickr-disabled");
734 }
735
736 if (self.config.mode === "range") {

Callers 1

buildMonthDaysFunction · 0.85

Calls 7

createElementFunction · 0.90
compareDatesFunction · 0.90
toggleClassFunction · 0.90
isEnabledFunction · 0.85
isDateSelectedFunction · 0.85
isDateInRangeFunction · 0.85
triggerEventFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…