Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/Service/CardService.php
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ public function delete(int $id): Card {
* @throws BadRequestException
*/
public function update(int $id, string $title, int $stackId, string $type, string $owner, string $description = '', int $order = 0, ?string $duedate = null, ?int $deletedAt = null, ?bool $archived = null, ?OptionalNullableValue $done = null): Card {
$this->cardServiceValidator->check(compact('id', 'title', 'stackId', 'type', 'owner', 'order'));
$this->cardServiceValidator->check(compact('id', 'title', 'stackId', 'type', 'owner', 'order', 'duedate'));

$this->permissionService->checkPermission($this->cardMapper, $id, Acl::PERMISSION_EDIT, allowDeletedCard: true);
$this->permissionService->checkPermission($this->stackMapper, $stackId, Acl::PERMISSION_EDIT);
Expand Down
10 changes: 10 additions & 0 deletions lib/Validators/BaseValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,16 @@ private function not_empty($value): bool {
return !empty($value);
}

/**
* @param $value
* @return bool
*/
private function date(string $value): bool {
$date = \DateTime::createFromFormat('Y-m-d\TH:i:s.v\Z', $value)
?: \DateTime::createFromFormat(\DateTime::ATOM, $value);
return $date !== false;
}

/**
* @throws Exception
*/
Expand Down
1 change: 1 addition & 0 deletions lib/Validators/CardServiceValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function rules() {
'type' => ['not_empty', 'not_null', 'not_false', 'max:64'],
'order' => ['numeric'],
'owner' => ['not_empty', 'not_null', 'not_false', 'max:64'],
'duedate' => ['date'],
];
}
}
3 changes: 2 additions & 1 deletion src/components/card/DueDateSelector.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
v-model="duedate"
:placeholder="t('deck', 'Set a due date')"
:hide-label="true"
type="datetime-local" />
type="datetime-local"
:max="new Date('9999-12-31T23:59:59')"/>
<NcActions v-if="canEdit"
:menu-title="!duedate ? t('deck', 'Add due date') : null"
type="tertiary"
Expand Down