diff --git a/marko/page/story-content/components/create-chapter-modal/component.js b/marko/page/story-content/components/create-chapter-modal/component.js index 184f0d3..6b7f4e8 100644 --- a/marko/page/story-content/components/create-chapter-modal/component.js +++ b/marko/page/story-content/components/create-chapter-modal/component.js @@ -53,8 +53,12 @@ module.exports = class { let fictionalDate = new Date(values.fictionalDate + " UTC") if (values.fictionalDate != "") { - if (Number.isNaN(fictionalDate)) { - this.state.error = `Could not parse ${values.fictionalDate} as date!` + if (Number.isNaN(fictionalDate.getTime())) { + this.state.error = `Could not parse ${values.fictionalDate} as date.` + if (values.fictionalDate.includes("th")) { + this.state.error += " Try to remove the 'th'." + } + return } } else { diff --git a/marko/page/story-content/components/edit-chapter-modal/component.js b/marko/page/story-content/components/edit-chapter-modal/component.js index dedbebb..605f2c0 100644 --- a/marko/page/story-content/components/edit-chapter-modal/component.js +++ b/marko/page/story-content/components/edit-chapter-modal/component.js @@ -49,8 +49,12 @@ module.exports = class { let fictionalDate = new Date(values.fictionalDate + " UTC") if (values.fictionalDate != "") { - if (Number.isNaN(fictionalDate)) { - this.state.error = `Could not parse ${values.fictionalDate} as date` + if (Number.isNaN(fictionalDate.getTime())) { + this.state.error = `Could not parse ${values.fictionalDate} as date.` + if (values.fictionalDate.includes("th")) { + this.state.error += " Try to remove the 'th'." + } + return } } else {