MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / renderCustomDateInputs

Method renderCustomDateInputs

src/views/StatsView.ts:917–962  ·  view source on GitHub ↗

* Render custom date inputs when needed

(container?: HTMLElement)

Source from the content-addressed store, hash-verified

915 * Render custom date inputs when needed
916 */
917 private renderCustomDateInputs(container?: HTMLElement) {
918 const customDatesContainer =
919 container ||
920 (this.filtersEl?.querySelector(".stats-view__custom-dates") as HTMLElement);
921 if (!customDatesContainer) return;
922
923 customDatesContainer.empty();
924
925 if (this.currentFilters.dateRange === "custom") {
926 const startDateContainer = customDatesContainer.createDiv({
927 cls: "stats-view__date-input-container",
928 });
929 startDateContainer.createDiv({
930 cls: "stats-view__date-label",
931 text: this.plugin.i18n.translate("views.stats.dateRangeFrom"),
932 });
933 const startInput = startDateContainer.createEl("input", {
934 cls: "stats-view__date-input",
935 type: "date",
936 value: this.currentFilters.customStartDate || "",
937 });
938
939 const endDateContainer = customDatesContainer.createDiv({
940 cls: "stats-view__date-input-container",
941 });
942 endDateContainer.createDiv({
943 cls: "stats-view__date-label",
944 text: this.plugin.i18n.translate("views.stats.dateRangeTo"),
945 });
946 const endInput = endDateContainer.createEl("input", {
947 cls: "stats-view__date-input",
948 type: "date",
949 value: this.currentFilters.customEndDate || "",
950 });
951
952 this.registerDomEvent(startInput, "change", () => {
953 this.currentFilters.customStartDate = startInput.value;
954 void this.applyFilters();
955 });
956
957 this.registerDomEvent(endInput, "change", () => {
958 this.currentFilters.customEndDate = endInput.value;
959 void this.applyFilters();
960 });
961 }
962 }
963
964 /**
965 * Apply current filters and refresh statistics with debouncing

Callers 1

renderFiltersMethod · 0.95

Calls 2

applyFiltersMethod · 0.95
translateMethod · 0.65

Tested by

no test coverage detected