Skip to content

Commit

Permalink
feat: Add created date to EditTask modal (#1745)
Browse files Browse the repository at this point in the history
  • Loading branch information
vanadium23 committed Mar 9, 2023
1 parent 5dc5755 commit 180870e
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions src/ui/EditTask.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
status: Status;
priority: 'none' | 'low' | 'medium' | 'high';
recurrenceRule: string;
createdDate: string;
startDate: string;
scheduledDate: string;
dueDate: string;
Expand All @@ -35,13 +36,15 @@
status: Status.TODO,
priority: 'none',
recurrenceRule: '',
createdDate: '',
startDate: '',
scheduledDate: '',
dueDate: '',
doneDate: '',
forwardOnly: true
};
let parsedCreated: string = '';
let parsedStartDate: string = '';
let isStartDateValid: boolean = true;
let parsedScheduledDate: string = '';
Expand Down Expand Up @@ -103,7 +106,7 @@
* @returns the parsed date string. Includes "invalid" if {@code typedDate} was invalid.
*/
function parseTypedDateForDisplay(
fieldName: 'start' | 'scheduled' | 'due' | 'done',
fieldName: 'created' | 'start' | 'scheduled' | 'due' | 'done',
typedDate: string,
forwardDate: Date | undefined = undefined,
): string {
Expand Down Expand Up @@ -192,6 +195,7 @@
}
$: {
parsedCreated = parseTypedDateForDisplay('created', editableTask.createdDate);
parsedDone = parseTypedDateForDisplay('done', editableTask.doneDate);
}
Expand Down Expand Up @@ -220,6 +224,9 @@
status: task.status,
priority,
recurrenceRule: task.recurrence ? task.recurrence.toText() : '',
createdDate: task.createdDate
? task.createdDate.format('YYYY-MM-DD')
: '',
startDate: task.startDate
? task.startDate.format('YYYY-MM-DD')
: '',
Expand Down Expand Up @@ -459,6 +466,13 @@
/>
</div>

<!-- --------------------------------------------------------------------------- -->
<!-- Created on -->
<!-- --------------------------------------------------------------------------- -->
<div>
<span>Created on:</span>
<code>{@html parsedCreated}</code>
</div>
<!-- --------------------------------------------------------------------------- -->
<!-- Done on -->
<!-- --------------------------------------------------------------------------- -->
Expand All @@ -474,4 +488,4 @@
<button type="button" on:click={_onClose}>Cancel</button>
</div>
</form>
</div>
</div>

0 comments on commit 180870e

Please sign in to comment.