From 341beac0fb2c1c50fc4d3aa20f6a788d2b724a5a Mon Sep 17 00:00:00 2001 From: Raphael Reynaud <82550120+raphyluke@users.noreply.github.com> Date: Fri, 29 Dec 2023 11:34:50 +0100 Subject: [PATCH] Ensure valueOf returns NaN for invalid instances (#1082) Closes #1075 --- moment-timezone.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/moment-timezone.js b/moment-timezone.js index dd2f0213..6e568cd2 100644 --- a/moment-timezone.js +++ b/moment-timezone.js @@ -640,7 +640,7 @@ offset; if (mom._z === undefined) { - if (zone && needsOffset(mom) && !mom._isUTC) { + if (zone && needsOffset(mom) && !mom._isUTC && mom.isValid()) { mom._d = moment.utc(mom._a)._d; mom.utc().add(zone.parse(mom), 'minutes'); }