title: scheduled tweets
body: <p><strong>tried to write a script that sends the date to twitter (scheduled tweets) but for some reason Twitter resets my date. How to fix it to make it work?</strong></p>
  <pre><code>(function () {
    &quot;use strict&quot;;
    var _main = document.querySelector(&quot;#react-root&quot;);
    var d = new Date();
  
    var dSplitted = {
      h: d.getHours(),
      m: d.getMinutes(),
      d: d.getDate(),
      mt: d.getMonth() + 1
    };
    const config = {
      attributes: false,
      childList: true,
      subtree: true
    };
  
    var modalOpen = false;
  
    var hourSelect;
    var daySelect;
    var monthSelect;
    var minuteSelect;
  
    // check if there is something in local storage
  
    // show date
    if (!document.querySelector(&quot;.js-container&quot;)) {
      var dStored = localStorage.getItem(&quot;_myDate&quot;);
      if (dStored.length) {
        dSplitted = JSON.parse(dStored);
      } else {
        if (dSplitted.h + 1 &lt; 24) {
          dSplitted.h += 1;
        } else {
          dSplitted.h = 0;
          dSplitted.d += 1;
        }
  
        console.log(dSplitted);
      }
  
      var _html = `&lt;div class=&quot;js-container&quot; style=&quot;background: #fff; color: black; position: fixed; z-index: 1000;top: 0; right: 0; width: 200px; height: 230px; padding: 10px; font-size: 18px; font-family: sans-serif&quot;&gt;
                  Hour:
                     &lt;input type=&quot;text&quot; value=&quot;${dSplitted.h}&quot; class=&quot;js-hour&quot; /&gt;&lt;br/&gt;
                     Minutes:
                     &lt;input type=&quot;text&quot; value=&quot;${dSplitted.m}&quot; class=&quot;js-min&quot; /&gt;&lt;br/&gt;
                     Day:
                     &lt;input type=&quot;text&quot; value=&quot;${dSplitted.d}&quot; class=&quot;js-day&quot; /&gt;&lt;br/&gt;
                     Month
                     &lt;input type=&quot;text&quot; value=&quot;${dSplitted.mt}&quot; class=&quot;js-month&quot; /&gt; &lt;br/&gt; &lt;br/&gt;
  
                     &lt;button class=&quot;js-set&quot; &gt;Set&lt;/button&gt;
                     &lt;/div&gt;`;
      _main.insertAdjacentHTML(&quot;beforebegin&quot;, _html);
    }
  
    var observer = new MutationObserver(function () {
      var modal = document.querySelector(&quot;[aria-labelledby=modal-header]&quot;);
      if (!modal || !modal.querySelectorAll(&quot;select&quot;)) {
        modalOpen = false;
        return;
      }
  
      if (modalOpen) {
        return;
      }
  
      var selects = Array.from(modal.querySelectorAll(&quot;select&quot;));
      if (selects.length &lt; 4) return;
      hourSelect = selects[3];
      daySelect = selects[1];
      monthSelect = selects[0];
      minuteSelect = selects[4];
      modalOpen = true;
  
      setTimeout((_) =&gt; {
        if (dSplitted) {
          // deal with inputs
          hourSelect.value = +dSplitted.h + 1;
          daySelect.value = +dSplitted.d;
          minuteSelect.value = +dSplitted.m;
        }
  
        dSplitted.h = +dSplitted.h + 1;
        localStorage.setItem(&quot;_myDate&quot;, JSON.stringify(dSplitted));
  
        document.querySelector(&quot;.js-day&quot;).value = dSplitted.d;
        document.querySelector(&quot;.js-month&quot;).value = dSplitted.mt;
        document.querySelector(&quot;.js-min&quot;).value = dSplitted.m;
        document.querySelector(&quot;.js-hour&quot;).value = dSplitted.h;
      }, 2500);
    });
  
    document.addEventListener(&quot;click&quot;, (e) =&gt; {
      if (e.target.innerText == &quot;Подтвердить&quot;) {
        modalOpen = false;
        localStorage.setItem(&quot;_myDate&quot;, JSON.stringify(dSplitted));
      }
  
      if (e.target.classList.contains(&quot;js-set&quot;)) {
        dSplitted.d = +document.querySelector(&quot;.js-day&quot;).value;
        dSplitted.mt = +document.querySelector(&quot;.js-month&quot;).value;
        dSplitted.m = +document.querySelector(&quot;.js-min&quot;).value;
        dSplitted.h = +document.querySelector(&quot;.js-hour&quot;).value;
  
        // selects
  
        if (hourSelect) {
          hourSelect.value = dSplitted.h;
          daySelect.value = dSplitted.d;
          monthSelect.value = dSplitted.mt;
          minuteSelect.value = dSplitted.m;
        }
        localStorage.setItem(&quot;_myDate&quot;, JSON.stringify(dSplitted));
      }
    });
  
    observer.observe(_main, config);
    // Your code here...
  })();
  </code></pre>
  <p>Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.</p>