Skip to content

Today button #351

Open
Open

Description

@xFrG73

Your issue may already be reported!
Please search on the issue track before creating one.

  • Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
  • Are you running the latest version?
  • Are you reporting to the correct repository?

Bug Report

Environment

  • Extension version(s): 7.1.1
  • Bulma version: 1.0.2
  • OS: W11
  • Browser: Chrome,Edge,Arc
  • How you are customizing the extension: no

Current Behavior
When used in range mode, the today button works on the start date but when used on the end date, the date value is not returned

const calendars = bulmaCalendar.attach('[type="date"]', {
    lang: "fr",
    isRange: true,
    showHeader: false,
    dateFormat: "dd/MM/yyyy",
    cancelLabel: 'Annuler',
    clearLabel: 'Effacer',
    validateLabel: 'Valider',
    todayLabel: 'Aujourd\'hui',
    labelFrom: 'De',
    labelTo: 'à',
  });

  const specificElement = document.querySelector("#inputDate");
  if (specificElement && specificElement.bulmaCalendar) {
    specificElement.bulmaCalendar.on("select", (datepicker) => {
      const selectedRange = datepicker.data.value(); 
      logError(selectedRange);
      if (selectedRange) {
        const [startDate, endDate] = selectedRange.split(" - "); 
        if (startDate && endDate) {
          getElement("startDate").value = startDate.trim();
          getElement("endDate").value = endDate.trim();
          applyFilters();
        }
      }
    });
    specificElement.bulmaCalendar.on("clear", () => {
      getElement("startDate").value = "";
      getElement("endDate").value = "";
      applyFilters();
    });
  }

Possible Solution
I think it's an event issue, when we press the today button, the value should be assigned (const selectedRange = datepicker.data.value();
logError(selectedRange);) returns nothing

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions