From a15b7e0eb845960d83a522edee0a3ab6aed93887 Mon Sep 17 00:00:00 2001 From: alexm Date: Thu, 25 Apr 2024 10:44:08 +0200 Subject: [PATCH] fix(util_log): refs #7268 fix getChanges when is datestring --- loopback/util/log.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/loopback/util/log.js b/loopback/util/log.js index 76e87781d..d2b78ce70 100644 --- a/loopback/util/log.js +++ b/loopback/util/log.js @@ -85,8 +85,12 @@ exports.translateValues = async(instance, changes, options = {}) => { exports.getChanges = (original, changes) => { const oldChanges = {}; const newChanges = {}; + const dateRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/; for (let property in changes) { + if (dateRegex.test(original[property])) + original[property] = new Date(Date.parse(original[property])); + const firstChar = property.substring(0, 1); const isPrivate = firstChar == '$'; if (isPrivate) return; -- 2.40.1