Skip to content

Commit

Permalink
Issue exceljs#488
Browse files Browse the repository at this point in the history
Fix Issue exceljs#488 where dt is an invalid time format, catch the exception and return blank string.
  • Loading branch information
dljenkins authored May 24, 2018
1 parent 95d59ca commit 12d9236
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/xlsx/xform/simple/date-xform.js
Original file line number Diff line number Diff line change
Expand Up @@ -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); };
};

Expand Down

0 comments on commit 12d9236

Please sign in to comment.