diff --git a/backend/utils.py b/backend/utils.py
index b1eaf39..ef71ca4 100644
--- a/backend/utils.py
+++ b/backend/utils.py
@@ -7,7 +7,7 @@ import re
import shutil
from pathlib import Path
from typing import List, Dict, Optional, Tuple
-from datetime import datetime
+from datetime import datetime, timezone
# In-memory cache for parsed tags
@@ -201,7 +201,7 @@ def get_all_notes(notes_dir: str) -> List[Dict]:
"name": md_file.stem,
"path": str(relative_path.as_posix()),
"folder": str(relative_path.parent.as_posix()) if str(relative_path.parent) != "." else "",
- "modified": datetime.fromtimestamp(stat.st_mtime).isoformat(),
+ "modified": datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat(),
"size": stat.st_size,
"type": "note",
"tags": tags
@@ -354,8 +354,8 @@ def create_note_metadata(notes_dir: str, note_path: str) -> Dict:
line_count = sum(1 for _ in f)
return {
- "created": datetime.fromtimestamp(stat.st_ctime).isoformat(),
- "modified": datetime.fromtimestamp(stat.st_mtime).isoformat(),
+ "created": datetime.fromtimestamp(stat.st_ctime, tz=timezone.utc).isoformat(),
+ "modified": datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat(),
"size": stat.st_size,
"lines": line_count
}
@@ -477,7 +477,7 @@ def get_all_images(notes_dir: str) -> List[Dict]:
"name": image_file.name,
"path": str(relative_path.as_posix()),
"folder": str(relative_path.parent.as_posix()),
- "modified": datetime.fromtimestamp(stat.st_mtime).isoformat(),
+ "modified": datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat(),
"size": stat.st_size,
"type": "image"
})
@@ -667,7 +667,7 @@ def get_notes_by_tag(notes_dir: str, tag: str) -> List[Dict]:
"name": md_file.stem,
"path": str(relative_path.as_posix()),
"folder": str(relative_path.parent.as_posix()) if str(relative_path.parent) != "." else "",
- "modified": datetime.fromtimestamp(stat.st_mtime).isoformat(),
+ "modified": datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat(),
"size": stat.st_size,
"tags": tags
})
@@ -712,7 +712,7 @@ def get_templates(notes_dir: str) -> List[Dict]:
templates.append({
"name": template_file.stem,
"path": str(template_file.relative_to(notes_dir).as_posix()),
- "modified": datetime.fromtimestamp(stat.st_mtime).isoformat()
+ "modified": datetime.fromtimestamp(stat.st_mtime, tz=timezone.utc).isoformat()
})
except Exception as e:
print(f"Error reading template {template_file}: {e}")
diff --git a/documentation/FEATURES.md b/documentation/FEATURES.md
index 6c525b7..34048c0 100644
--- a/documentation/FEATURES.md
+++ b/documentation/FEATURES.md
@@ -50,6 +50,7 @@
- **Shareable links** - Bookmark or share direct links to notes with highlighted terms
- **Refresh safe** - Page reload keeps you on the same note with search context
- **Copy link button** - One-click copy of note URL to clipboard
+- **Last edited indicator** - Shows relative time since last edit (e.g., "Edited 2h ago")
## 🎨 Customization
diff --git a/frontend/app.js b/frontend/app.js
index fe8b3ab..e10a77d 100644
--- a/frontend/app.js
+++ b/frontend/app.js
@@ -940,6 +940,29 @@ function noteApp() {
return note && note.tags ? note.tags : [];
},
+ // Get current note's last modified time as relative string
+ get lastEditedText() {
+ if (!this.currentNote) return '';
+ const note = this.notes.find(n => n.path === this.currentNote);
+ if (!note || !note.modified) return '';
+
+ const modified = new Date(note.modified);
+ const now = new Date();
+ const diffMs = now - modified;
+ const diffSecs = Math.floor(diffMs / 1000);
+ const diffMins = Math.floor(diffSecs / 60);
+ const diffHours = Math.floor(diffMins / 60);
+ const diffDays = Math.floor(diffHours / 24);
+
+ if (diffSecs < 60) return 'just now';
+ if (diffMins < 60) return `${diffMins}m ago`;
+ if (diffHours < 24) return `${diffHours}h ago`;
+ if (diffDays < 7) return `${diffDays}d ago`;
+
+ // For older dates, show the date
+ return modified.toLocaleDateString(undefined, { month: 'short', day: 'numeric' });
+ },
+
// Parse tags from markdown content (matches backend logic)
parseTagsFromContent(content) {
if (!content || !content.trim().startsWith('---')) {
diff --git a/frontend/index.html b/frontend/index.html
index 609b74c..011f61d 100644
--- a/frontend/index.html
+++ b/frontend/index.html
@@ -1889,6 +1889,7 @@
Saving...
✓ Saved
+