From 12d92364591bfee75d477945bf2acd6651916e11 Mon Sep 17 00:00:00 2001 From: dljenkins Date: Thu, 24 May 2018 10:09:18 -0400 Subject: [PATCH] Issue #488 Fix Issue #488 where dt is an invalid time format, catch the exception and return blank string. --- lib/xlsx/xform/simple/date-xform.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/xlsx/xform/simple/date-xform.js b/lib/xlsx/xform/simple/date-xform.js index 72c60fcee..e64c096d9 100644 --- a/lib/xlsx/xform/simple/date-xform.js +++ b/lib/xlsx/xform/simple/date-xform.js @@ -13,7 +13,13 @@ var DateXform = module.exports = function(options) { this.tag = options.tag; this.attr = options.attr; this.attrs = options.attrs; - this._format = options.format || function(dt) { return dt.toISOString(); }; + this._format = options.format || function (dt) { + try { + return dt.toISOString(); + } catch(e) { + return ''; + } + }; this._parse = options.parse || function(str) { return new Date(str); }; };