Skip to content

feat: display note creation and last updated timestamps#66

Open
BhumikaHunachyali wants to merge 1 commit into
niharika-mente:mainfrom
BhumikaHunachyali:note-timestamps
Open

feat: display note creation and last updated timestamps#66
BhumikaHunachyali wants to merge 1 commit into
niharika-mente:mainfrom
BhumikaHunachyali:note-timestamps

Conversation

@BhumikaHunachyali

@BhumikaHunachyali BhumikaHunachyali commented Jun 16, 2026

Copy link
Copy Markdown

This PR adds note timestamp information to improve note tracking and visibility.

Changes Made

  • Displayed note creation date and time.
  • Displayed last updated date and time.
  • Added timestamp information to note cards on the home page.
  • Added timestamp information to the note detail page.
  • Added a dedicated date-time formatting utility for consistent display.

Benefits

Users can now easily see:

  • When a note was created.
  • When a note was last modified.

This improves note management and provides better context when reviewing or editing notes.

Summary by CodeRabbit

  • New Features
    • Notes now display both creation and last-updated timestamps with full date and time information, providing improved visibility into note history
    • Timestamp information appears on both note cards and note detail pages, allowing users to see exactly when notes were created and when they were last modified
    • Users gain better transparency into note changes and revisions

@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

A new formatDateTime utility is added to utils.js using toLocaleString("en-US") with date and time options. NoteCard switches from formatDate to formatDateTime and replaces its single "Created" footer row with stacked "Created" and "Updated" rows. NoteDetailPage gains a new timestamp block showing both createdAt and updatedAt.

Changes

Note Timestamp Display

Layer / File(s) Summary
formatDateTime utility
frontend/src/lib/utils.js
Exports a new formatDateTime(date) function that calls toLocaleString("en-US") with month, day, year, hour, and minute options alongside the existing formatDate.
Timestamp UI in card and detail view
frontend/src/components/NoteCard.jsx, frontend/src/pages/NoteDetailPage.jsx
NoteCard updates its import to formatDateTime and replaces the single "Created" footer row with a vertically stacked "Created"/"Updated" layout. NoteDetailPage inserts a "Timestamp Info" block rendering createdAt and updatedAt via toLocaleString().

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐇 Hop, hop, what time is it now?
Both created and updated, I'll show you how!
A locale string here, a timestamp there,
The notes remember when they were born with care.
No more guessing — the clock's on display! 🕐

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: display note creation and last updated timestamps' directly and accurately summarizes the main change—adding timestamp display functionality for note creation and updates across the application.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between b13fd53 and 4012c1d.

📒 Files selected for processing (3)
  • frontend/src/components/NoteCard.jsx
  • frontend/src/lib/utils.js
  • frontend/src/pages/NoteDetailPage.jsx

Comment on lines +130 to +138
{/* 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>

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major | ⚡ Quick win

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.

Suggested change
{/* 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant