Notepad icon indicating copy to clipboard operation
Notepad copied to clipboard

Preserve modified date when importing notes with date info

Open samontab opened this issue 1 year ago • 0 comments

Although the export functionality of the app correctly writes the modified date into the filename(if selected in settings), the import functionality ignores this date and always uses the current date as the modified date, which is not ideal.

This PR uses the filename of the exported note to check if there's any modified date there in the format yyyy-MM-dd-HH-mm and sets the imported note's modified date with it. If there's no date found in that format it defaults to the current date.

imported_correctly

Since this is the date format used by the export functionality this obviously works for notes exported with this app, but it also works with exported notes from any other app as long as the modified date is provided in exactly that format anywhere in the filename, for example: 2023-03-15-20-19_my_note.txt.

This PR fixes #150 and resolves #67 (regression) as well as helps people to fix #51

samontab avatar Feb 13 '24 09:02 samontab