mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-24 10:27:10 +02:00
This commit is contained in:
parent
94e3582bb8
commit
32e76d7988
@ -0,0 +1,9 @@
|
|||||||
|
---
|
||||||
|
title: "Frontmatter test"
|
||||||
|
created_at: 01-01-2024 01:23 AM
|
||||||
|
updated_at: 02-01-2024 04:56 AM
|
||||||
|
---
|
||||||
|
|
||||||
|
# Frontmatter test
|
||||||
|
|
||||||
|
A test note with frontmatter.
|
@ -140,6 +140,13 @@ describe('InteropService_Importer_Md_frontmatter: importMetadata', () => {
|
|||||||
expect(note.title).toBe('Distill for R Markdown');
|
expect(note.title).toBe('Distill for R Markdown');
|
||||||
expect(note.author).toBe('JJ Allaire');
|
expect(note.author).toBe('JJ Allaire');
|
||||||
});
|
});
|
||||||
|
it('should import Notesnook files with created and update timestamps', async () => {
|
||||||
|
const note = await importTestFile('notesnook_updated_created.md');
|
||||||
|
|
||||||
|
expect(note.title).toBe('Frontmatter test');
|
||||||
|
expect(note.user_created_time).toBe(Date.parse('2024-01-01T01:23:00.000'));
|
||||||
|
expect(note.user_updated_time).toBe(Date.parse('2024-01-02T04:56:00.000'));
|
||||||
|
});
|
||||||
it('should handle date formats with timezone information', async () => {
|
it('should handle date formats with timezone information', async () => {
|
||||||
const note = await importTestFile('utc.md');
|
const note = await importTestFile('utc.md');
|
||||||
|
|
||||||
|
@ -111,6 +111,9 @@ export default class InteropService_Importer_Md_frontmatter extends InteropServi
|
|||||||
metadata['user_created_time'] = time.anythingToMs(md['created'], Date.now());
|
metadata['user_created_time'] = time.anythingToMs(md['created'], Date.now());
|
||||||
} else if ('date' in md) {
|
} else if ('date' in md) {
|
||||||
metadata['user_created_time'] = time.anythingToMs(md['date'], Date.now());
|
metadata['user_created_time'] = time.anythingToMs(md['date'], Date.now());
|
||||||
|
} else if ('created_at' in md) {
|
||||||
|
// Add support for Notesnook
|
||||||
|
metadata['user_created_time'] = time.anythingToMs(md['created_at'], Date.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('updated' in md) {
|
if ('updated' in md) {
|
||||||
@ -120,6 +123,9 @@ export default class InteropService_Importer_Md_frontmatter extends InteropServi
|
|||||||
metadata['user_updated_time'] = time.anythingToMs(md['lastmod'], Date.now());
|
metadata['user_updated_time'] = time.anythingToMs(md['lastmod'], Date.now());
|
||||||
} else if ('date' in md) {
|
} else if ('date' in md) {
|
||||||
metadata['user_updated_time'] = time.anythingToMs(md['date'], Date.now());
|
metadata['user_updated_time'] = time.anythingToMs(md['date'], Date.now());
|
||||||
|
} else if ('updated_at' in md) {
|
||||||
|
// Notesnook
|
||||||
|
metadata['user_updated_time'] = time.anythingToMs(md['updated_at'], Date.now());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('latitude' in md) { metadata['latitude'] = md['latitude']; }
|
if ('latitude' in md) { metadata['latitude'] = md['latitude']; }
|
||||||
|
Loading…
Reference in New Issue
Block a user