diff --git a/lib/utils/utils.js b/lib/utils/utils.js index 21dd20ee9..6b4afe143 100644 --- a/lib/utils/utils.js +++ b/lib/utils/utils.js @@ -57,6 +57,7 @@ const utils = { return 25569 + d.getTime() / (24 * 3600 * 1000) - (date1904 ? 1462 : 0); }, excelToDate(v, date1904) { + if (!Number.isFinite(v)) return v; // dmjp: If v isn't actually a date, eg the cell style is a date format but the value isn't numeric, then return v instead of "Invalid Date". // eslint-disable-next-line no-mixed-operators const millisecondSinceEpoch = Math.round((v - 25569 + (date1904 ? 1462 : 0)) * 24 * 3600 * 1000); return new Date(millisecondSinceEpoch);