Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add created date to EditTask modal #1745

Merged
Merged
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
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>
claremacrae marked this conversation as resolved.
Show resolved Hide resolved
<!-- --------------------------------------------------------------------------- -->
<!-- Done on -->
<!-- --------------------------------------------------------------------------- -->
Expand All @@ -474,4 +488,4 @@
<button type="button" on:click={_onClose}>Cancel</button>
</div>
</form>
</div>
</div>