feat: display note creation and last updated timestamps#66
feat: display note creation and last updated timestamps#66BhumikaHunachyali wants to merge 1 commit into
Conversation
📝 WalkthroughWalkthroughA new ChangesNote Timestamp Display
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@frontend/src/pages/NoteDetailPage.jsx`:
- Around line 130-138: The date and time formatting in NoteDetailPage.jsx at the
lines where note.createdAt and note.updatedAt are displayed bypasses the shared
formatDateTime function, creating inconsistent date formatting across the
application. Replace the direct new Date(note.createdAt).toLocaleString() and
new Date(note.updatedAt).toLocaleString() calls with calls to the formatDateTime
utility function to ensure consistent timestamp formatting throughout the UI,
maintaining the cross-file formatting contract established in this PR.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ba916acf-478e-44ac-81d4-441de7a4a6d5
📒 Files selected for processing (3)
frontend/src/components/NoteCard.jsxfrontend/src/lib/utils.jsfrontend/src/pages/NoteDetailPage.jsx
| {/* Timestamp Info */} | ||
| <div className="mb-4 text-sm text-gray-500 dark:text-gray-400"> | ||
| <p> | ||
| Created: {new Date(note.createdAt).toLocaleString()} | ||
| </p> | ||
| <p> | ||
| Last Updated: {new Date(note.updatedAt).toLocaleString()} | ||
| </p> | ||
| </div> |
There was a problem hiding this comment.
Use the shared timestamp formatter here to keep UI output consistent.
Line 133 and Line 136 bypass formatDateTime, so this page can render different date/time formats than note cards. That breaks the cross-file formatting contract introduced in this PR.
Suggested fix
import { useEffect, useState } from "react";
import { Link, useNavigate, useParams } from "react-router-dom";
import api from "../lib/axios";
import toast from "react-hot-toast";
import { ArrowLeftIcon, LoaderIcon, Trash2Icon } from "lucide-react";
+import { formatDateTime } from "../lib/utils";
@@
<div className="mb-4 text-sm text-gray-500 dark:text-gray-400">
<p>
- Created: {new Date(note.createdAt).toLocaleString()}
+ Created: {formatDateTime(new Date(note.createdAt))}
</p>
<p>
- Last Updated: {new Date(note.updatedAt).toLocaleString()}
+ Last Updated: {formatDateTime(new Date(note.updatedAt))}
</p>
</div>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| {/* Timestamp Info */} | |
| <div className="mb-4 text-sm text-gray-500 dark:text-gray-400"> | |
| <p> | |
| Created: {new Date(note.createdAt).toLocaleString()} | |
| </p> | |
| <p> | |
| Last Updated: {new Date(note.updatedAt).toLocaleString()} | |
| </p> | |
| </div> | |
| import { useEffect, useState } from "react"; | |
| import { Link, useNavigate, useParams } from "react-router-dom"; | |
| import api from "../lib/axios"; | |
| import toast from "react-hot-toast"; | |
| import { ArrowLeftIcon, LoaderIcon, Trash2Icon } from "lucide-react"; | |
| import { formatDateTime } from "../lib/utils"; | |
| // ... other code ... | |
| {/* Timestamp Info */} | |
| <div className="mb-4 text-sm text-gray-500 dark:text-gray-400"> | |
| <p> | |
| Created: {formatDateTime(new Date(note.createdAt))} | |
| </p> | |
| <p> | |
| Last Updated: {formatDateTime(new Date(note.updatedAt))} | |
| </p> | |
| </div> |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@frontend/src/pages/NoteDetailPage.jsx` around lines 130 - 138, The date and
time formatting in NoteDetailPage.jsx at the lines where note.createdAt and
note.updatedAt are displayed bypasses the shared formatDateTime function,
creating inconsistent date formatting across the application. Replace the direct
new Date(note.createdAt).toLocaleString() and new
Date(note.updatedAt).toLocaleString() calls with calls to the formatDateTime
utility function to ensure consistent timestamp formatting throughout the UI,
maintaining the cross-file formatting contract established in this PR.
This PR adds note timestamp information to improve note tracking and visibility.
Changes Made
Benefits
Users can now easily see:
This improves note management and provides better context when reviewing or editing notes.
Summary by CodeRabbit