diff --git a/marko/page/logs/components/add-log-modal/component.js b/marko/page/logs/components/add-log-modal/component.js index 8127493..8c6316c 100644 --- a/marko/page/logs/components/add-log-modal/component.js +++ b/marko/page/logs/components/add-log-modal/component.js @@ -40,13 +40,23 @@ module.exports = class { } const input = Object.assign({}, this.state.values) - + if (input.date == "") { + this.state.error = "You need to specify a date (Did you mean "+moment().format("YYYY-MM-DD HH:mm:ss")+"?)" + return + } + input.date = new Date(input.date) if (Number.isNaN(input.date)) { this.state.error = "Invalid date" return } + // They're not the same space! + if (input.channel.length < 2 || input.channel.includes(" ") || input.channel.includes(" ") || input.channel.charAt(0) !== "#") { + this.state.error = "Invalid channel name" + return + } + this.state.loading = true logsApi.add(input).then(log => { window.location = `/logs/${log.id}/`