diff --git a/lib/xlsx/xform/simple/date-xform.js b/lib/xlsx/xform/simple/date-xform.js
index e64c096d9..331e759a7 100644
--- a/lib/xlsx/xform/simple/date-xform.js
+++ b/lib/xlsx/xform/simple/date-xform.js
@@ -13,8 +13,9 @@ var DateXform = module.exports = function(options) {
this.tag = options.tag;
this.attr = options.attr;
this.attrs = options.attrs;
- this._format = options.format || function (dt) {
+ this._format = options.format || function (dt) {
try {
+ if (isNaN(dt.getTime())) return '';
return dt.toISOString();
} catch(e) {
return '';
diff --git a/spec/unit/xlsx/xform/simple/date-xform.spec.js b/spec/unit/xlsx/xform/simple/date-xform.spec.js
index 55dd3c262..11baba41c 100644
--- a/spec/unit/xlsx/xform/simple/date-xform.spec.js
+++ b/spec/unit/xlsx/xform/simple/date-xform.spec.js
@@ -33,7 +33,16 @@ var expectations = [
preparedModel: undefined,
xml: '',
tests: ['render', 'renderIn']
+ },
+ {
+ title: 'invalid date',
+ create: function() { return new DateXform({tag: 'date', attr: undefined}); },
+ preparedModel: new Date(undefined),
+ xml: '
Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.
Alternative Proxies: