From 1299141f2e9e909e2182d8d7e99e372349dc7e0f Mon Sep 17 00:00:00 2001 From: David Losada Date: Wed, 4 Nov 2020 13:35:15 +0100 Subject: [PATCH] Revert "fix(posts-form): Fixes default date field" This reverts commit 1457996ba96ffad0feaea36250c7f48688ca1d3e. Reason: it caused bug ushahidi/platform#4155 --- app/main/posts/modify/post-editor.directive.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/main/posts/modify/post-editor.directive.js b/app/main/posts/modify/post-editor.directive.js index 2a132bbeae..ae66e143e9 100644 --- a/app/main/posts/modify/post-editor.directive.js +++ b/app/main/posts/modify/post-editor.directive.js @@ -159,15 +159,7 @@ function PostEditorController( } else if (attr.input === 'number') { $scope.post.values[attr.key] = [parseInt(attr.default)]; } else if (attr.input === 'date' || attr.input === 'datetime') { - // If there is a default value for this input type, parse it. - // If there isn't, display today's date if it is a required field, - // otherwise pass in a bogus string, which gives an empty date. - if (attr.default) { - $scope.post.values[attr.key] = [new Date(attr.default)]; - } - else { - $scope.post.values[attr.key] = (attr.required) ? [new Date()] : [new Date('')]; - } + $scope.post.values[attr.key] = attr.default ? [new Date(attr.default)] : [new Date()]; } else { $scope.post.values[attr.key] = [attr.default]; }