@aws-lambda-powertools/metrics
Advanced tools
Comparing version 2.12.0 to 2.13.0
@@ -5,3 +5,2 @@ "use strict"; | ||
const node_console_1 = require("node:console"); | ||
const types_1 = require("node:util/types"); | ||
const commons_1 = require("@aws-lambda-powertools/commons"); | ||
@@ -903,6 +902,7 @@ const EnvironmentVariablesService_js_1 = require("./config/EnvironmentVariablesService.js"); | ||
#validateEmfTimestamp(timestamp) { | ||
if (!(0, types_1.isDate)(timestamp) && !(0, commons_1.isIntegerNumber)(timestamp)) { | ||
const isDate = timestamp instanceof Date; | ||
if (!isDate && !(0, commons_1.isIntegerNumber)(timestamp)) { | ||
return false; | ||
} | ||
const timestampMs = (0, types_1.isDate)(timestamp) ? timestamp.getTime() : timestamp; | ||
const timestampMs = isDate ? timestamp.getTime() : timestamp; | ||
const currentTime = new Date().getTime(); | ||
@@ -923,3 +923,3 @@ const minValidTimestamp = currentTime - constants_js_1.EMF_MAX_TIMESTAMP_PAST_AGE; | ||
} | ||
if ((0, types_1.isDate)(timestamp)) { | ||
if (timestamp instanceof Date) { | ||
return timestamp.getTime(); | ||
@@ -926,0 +926,0 @@ } |
import { Console } from 'node:console'; | ||
import { isDate } from 'node:util/types'; | ||
import { Utility, isIntegerNumber } from '@aws-lambda-powertools/commons'; | ||
@@ -899,6 +898,7 @@ import { EnvironmentVariablesService } from './config/EnvironmentVariablesService.js'; | ||
#validateEmfTimestamp(timestamp) { | ||
if (!isDate(timestamp) && !isIntegerNumber(timestamp)) { | ||
const isDate = timestamp instanceof Date; | ||
if (!isDate && !isIntegerNumber(timestamp)) { | ||
return false; | ||
} | ||
const timestampMs = isDate(timestamp) ? timestamp.getTime() : timestamp; | ||
const timestampMs = isDate ? timestamp.getTime() : timestamp; | ||
const currentTime = new Date().getTime(); | ||
@@ -919,3 +919,3 @@ const minValidTimestamp = currentTime - EMF_MAX_TIMESTAMP_PAST_AGE; | ||
} | ||
if (isDate(timestamp)) { | ||
if (timestamp instanceof Date) { | ||
return timestamp.getTime(); | ||
@@ -922,0 +922,0 @@ } |
{ | ||
"name": "@aws-lambda-powertools/metrics", | ||
"version": "2.12.0", | ||
"version": "2.13.0", | ||
"description": "The metrics package for the Powertools for AWS Lambda (TypeScript) library", | ||
@@ -27,3 +27,3 @@ "author": { | ||
"dependencies": { | ||
"@aws-lambda-powertools/commons": "^2.12.0" | ||
"@aws-lambda-powertools/commons": "^2.13.0" | ||
}, | ||
@@ -30,0 +30,0 @@ "peerDependencies": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
225318