
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
dates-diference-calculator
Advanced tools
A library to calculate the time diference between the current date and a provided date.
dates-diference-calculator é uma biblioteca Node.js para calcular a diferença de tempo entre a data atual e uma data fornecida em dias, horas e minutos. Se a data fornecida estiver no passado, a função retornará uma mensagem de erro.
Você pode instalar a biblioteca via npm:
npm install dates-diference-calculator
Aqui está um exemplo de como usar a biblioteca:
const { calculateTimeDifference } = require('dates-diference-calculator');
try {
const result = calculateTimeDifference('2024-12-25T00:00:00');
if (result.error) {
console.error(result.error);
} else {
console.log(`Days: ${result.days}, Hours: ${result.hours}, Minutes: ${result.minutes}`);
}
} catch (error) {
console.error(error.message);
}
calculateTimeDifference(targetDate)Calcula a diferença de tempo entre a data atual e a data fornecida.
targetDate (string): A data alvo em um formato reconhecido pelo construtor Date do JavaScript.Se a data fornecida estiver no futuro:
{
"days": 10,
"hours": 5,
"minutes": 30
}
Se a data fornecida estiver no passado:
{
"error": "The date provided is in the past"
}
Se você encontrar algum problema ou tiver sugestões de melhoria, sinta-se à vontade para abrir uma issue ou um pull request no repositório do GitHub.
Este projeto está licenciado sob a licença MIT. Veja o arquivo LICENSE para mais detalhes.
Thiago Lima
Obrigado por usar dates-diference-calculator! Se você tiver alguma dúvida ou precisar de ajuda, entre em contato.
Certifique-se de atualizar as informações de acordo com suas necessidades específicas, incluindo seu nome e quaisquer outros detalhes que sejam relevantes para o seu projeto.
FAQs
A library to calculate the time diference between the current date and a provided date.
We found that dates-diference-calculator demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.