e-timologio | Invoice list set IssueDateFrom to One Year Ago

Set the IssueDateFrom input to one year ago

  1. // ==UserScript==
  2. // @name e-timologio | Invoice list set IssueDateFrom to One Year Ago
  3. // @namespace http://tampermonkey.net/
  4. // @version 0.1
  5. // @description Set the IssueDateFrom input to one year ago
  6. // @author Ratikal
  7. // @license MIT
  8. // @match https://mydata.aade.gr/timologio/invoice/listinvoices*
  9. // @grant none
  10. // ==/UserScript==
  11.  
  12. (function() {
  13. 'use strict';
  14. window.addEventListener('load', function() {
  15. setTimeout(function() {
  16. const issueDateFrom = document.getElementById('IssueDateFrom');
  17. if (issueDateFrom) {
  18. const currentDate = new Date();
  19. const month = String(currentDate.getMonth() + 1 - 2).padStart(2, '0');
  20. const year = currentDate.getFullYear();
  21. issueDateFrom.value = `01/${month}/${year}`;
  22. document.getElementById('mark').value = "";
  23. document.getElementById('btnSearch').click();
  24. }
  25. }, 50);
  26. });
  27. })();
  28.