From e4a39ec67cc11c05f948ca4bf0632fb7cc4694a6 Mon Sep 17 00:00:00 2001 From: Sebastian Kippe Date: Fri, 2 Aug 2019 16:58:12 +0200 Subject: [PATCH] Fix bug with default date input When the input isn't touched by the user, the date isn't stored as an array on the property. --- app/components/add-contribution/component.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/components/add-contribution/component.js b/app/components/add-contribution/component.js index 5a72ff6..0c25c85 100644 --- a/app/components/add-contribution/component.js +++ b/app/components/add-contribution/component.js @@ -50,7 +50,11 @@ export default Component.extend({ } const attributes = this.getProperties(Object.keys(this.attributes)); - const [ date, time ] = attributes.date[0].toISOString().split('T'); + + let dateInput = (attributes.date instanceof Array) ? + attributes.date[0] : attributes.date; + + const [ date, time ] = dateInput.toISOString().split('T'); [ attributes.date, attributes.time ] = [ date, time ]; this.set('inProgress', true);