UNPKG

@anderson.tec12/utils

Version:

[![npm version](https://badge.fury.io/js/%40anderson.tec12%2Futils.svg)](https://badge.fury.io/js/%40anderson.tec12%2Futils) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

13 lines (12 loc) 487 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isLessThan5Minutes = isLessThan5Minutes; function isLessThan5Minutes(dateParam) { const inputDate = dateParam; const now = new Date(); const diffMs = now.getTime() - inputDate.getTime(); // 5 minutos em milissegundos const fiveMinutesMs = 5 * 60 * 1000; // Retorna true se for menor que 5 minutos e a data não for no futuro return diffMs >= 0 && diffMs <= fiveMinutesMs; }