Skip to content

Commit

Permalink
Merge pull request #1613 from ushahidi/revert-1591
Browse files Browse the repository at this point in the history
Revert "fix(posts-form): Fixes default date field"
  • Loading branch information
tuxpiper authored Nov 4, 2020
2 parents 609914d + 1299141 commit 475254b
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions app/main/posts/modify/post-editor.directive.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}
Expand Down

0 comments on commit 475254b

Please sign in to comment.