statusInvestFunctions

Fornece funçoes de ajuda nos scripts

Dieses Skript sollte nicht direkt installiert werden. Es handelt sich hier um eine Bibliothek für andere Skripte, welche über folgenden Befehl in den Metadaten eines Skriptes eingebunden wird // @require https://update.greasyfork.org/scripts/477957/1268273/statusInvestFunctions.js

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         statusInvestFunctions
// @namespace    http://tampermonkey.net/
// @version      0.03
// @description  Fornece funçoes de ajuda nos scripts
// @author       @josias-soares
// @license      MIT
// ==/UserScript==

function calcularDiasDecorridos(dataFornecida) {

    // Hoje
    const hoje = new Date();

    // Converte a data fornecida para um objeto Date
    const dataFornecidaDate = new Date(dataFornecida);

    // Calcula a diferença em milissegundos
    const diferencaEmMilissegundos = dataFornecidaDate - hoje;

    // Converte a diferença em dias
    const diasDecorridos = Math.floor(diferencaEmMilissegundos / (1000 * 60 * 60 * 24));

    return diasDecorridos;
}

function getDataHojeFormatada(){
    // Hoje
    const hoje = new Date();

    // Obtém o ano, mês e dia da data atual
    const ano = hoje.getFullYear();
    const mes = String(hoje.getMonth() + 1).padStart(2, '0'); // O mês é baseado em zero (janeiro = 0)
    const dia = String(hoje.getDate()).padStart(2, '0');

    // Cria a string no formato 'YYYY-MM-DD'
    return `${ano}-${mes}-${dia}`;
}