nadchif / html-duration-picker.js

Turn an HTML input box to a duration picker, without jQuery
https://nadchif.github.io/html-duration-picker.js/
Apache License 2.0
45 stars 62 forks source link

html-duration-picker.js contains console log #178

Open NiekZndt opened 11 months ago

NiekZndt commented 11 months ago

Describe the bug html-duration-picker.js contains a console log on line 174 in the function insertFormatted. This console log outputs everytime you input a value in the input. This console.log should be removed

  const insertFormatted = (inputBox, secondsValue, dispatchSyntheticEvents, adjustmentFactor = 1) => {
    const hideSeconds = shouldHideSeconds(inputBox);
    const formattedValue = secondsToDuration(secondsValue, hideSeconds);
    const existingValue = inputBox.value;
    // Don't use setValue method here because
    // it breaks the arrow keys and arrow buttons control over the input
    inputBox.value = formattedValue;
    // save current cursor location for automatic increase

    // manually trigger an "input" event for other event listeners
    if (dispatchSyntheticEvents !== false) {
      if (existingValue != formattedValue) {
        inputBox.dispatchEvent(createEvent('change', {bubbles: true, cancelable: true}));
      }
      inputBox.dispatchEvent(createEvent('input'));
    }
    inputBox.setAttribute('data-adjustment-factor', adjustmentFactor);
    console.log({adjustmentFactor}); // <--------------
    highlightTimeUnitArea(inputBox, adjustmentFactor);
  };

To Reproduce Steps to reproduce the behavior:

  1. Add the input in an html file
  2. View the console.log for messages coming in

Expected behavior The console output console log messages.