Skip to content

Commit

Permalink
Ensure valueOf returns NaN for invalid instances (#1082)
Browse files Browse the repository at this point in the history
Closes #1075
  • Loading branch information
dev-ghostly authored Dec 29, 2023
1 parent dc53e6c commit 341beac
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion moment-timezone.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down

0 comments on commit 341beac

Please sign in to comment.