1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-07-13 00:10:37 +02:00

Desktop: Fix importing completed tasks (#10528)

This commit is contained in:
Henry Heino
2024-06-04 01:52:34 -07:00
committed by GitHub
parent e049698012
commit 0938dc9d52
4 changed files with 33 additions and 2 deletions

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);