Desktop: Fix importing completed tasks (#10528)

This commit is contained in:
Henry Heino authored and GitHub committed 2024-06-04 09:52:34 +01:00
1 parent e049698012
commit 0938dc9d52
4 files changed
+33 -2

No files matched your search

+2 -2
View File
@@ -101,7 +101,7 @@ export const serialize = async (modNote: NoteEntity, tagTitles: string[]) => {
};
function isTruthy(str: string): boolean {
return str.toLowerCase() in ['true', 'yes'];
return ['true', 'yes'].includes(str.toLowerCase());
}
// Enforces exactly 2 spaces in front of list items
@@ -227,7 +227,7 @@ export const parse = (note: string): ParsedMeta => {
if (metadata.is_todo) {
if (isTruthy(md['completed?'])) {
// Completed time isn't preserved, so we use a sane choice here
metadata['todo_completed'] = metadata['user_updated_time'];
metadata['todo_completed'] = metadata['user_updated_time'] ?? Date.now();
}
if ('due' in md) {
const due_date = time.anythingToMs(md['due'], null);