Skip to content

Add Backdate Memos feature — Set custom creation dates when writing new memos#5847

Open
PeriBluGaming wants to merge 6 commits into
usememos:mainfrom
PeriBluGaming:main
Open

Add Backdate Memos feature — Set custom creation dates when writing new memos#5847
PeriBluGaming wants to merge 6 commits into
usememos:mainfrom
PeriBluGaming:main

Conversation

@PeriBluGaming
Copy link
Copy Markdown

@PeriBluGaming PeriBluGaming commented Apr 17, 2026

Feature

Adds the ability to set a custom creation date when writing a new memo, allowing users to place memos anywhere on their timeline.

Use Cases

  • Journaling: Backdate journal entries to their actual dates
  • Importing: Preserve original dates when migrating notes from other tools
  • Timeline Management: Fill in historical events or past memories

Changes

  • new date picker in memo editor (UI)
  • no backend changes needed

Testing

  • Feature was tested on MacOS

Summary by CodeRabbit

  • New Features

    • Users can now set a custom creation date for new memos, allowing them to be placed anywhere on the timeline. Internationalization support added.
  • Documentation

    • Updated README with the new Backdate Memos feature description.

Copilot AI and others added 6 commits April 17, 2026 15:57
… past dates

Agent-Logs-Url: https://github.com/PeriBluGaming/memos/sessions/541e7a43-b75b-4720-9408-246422b8d4f4

Co-authored-by: PeriBluGaming <196774698+PeriBluGaming@users.noreply.github.com>
…one issues

Agent-Logs-Url: https://github.com/PeriBluGaming/memos/sessions/541e7a43-b75b-4720-9408-246422b8d4f4

Co-authored-by: PeriBluGaming <196774698+PeriBluGaming@users.noreply.github.com>
feat: add backdate popover to create memos with past dates
Agent-Logs-Url: https://github.com/PeriBluGaming/memos/sessions/4b1ea44c-6e4c-4dac-8466-b7a3cb670ead

Co-authored-by: PeriBluGaming <196774698+PeriBluGaming@users.noreply.github.com>
@PeriBluGaming PeriBluGaming requested a review from a team as a code owner April 17, 2026 16:25
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 17, 2026

📝 Walkthrough

Walkthrough

This pull request adds a new "Backdate Memos" feature that allows users to set a custom creation date for new memos. It introduces a BackdatePopover component with datetime input functionality, updates component exports, modifies the MemoEditor conditional rendering logic, and adds localization strings for English and German.

Changes

Cohort / File(s) Summary
Backdate Feature Component
web/src/components/MemoEditor/components/TimestampPopover.tsx
Added new BackdatePopover component with datetime-local input handling, date conversion utilities, and clear action. Includes calendar icon display and state management for popover visibility.
Component Exports
web/src/components/MemoEditor/components/index.ts
Updated barrel export to include new BackdatePopover component alongside existing TimestampPopover.
MemoEditor Integration
web/src/components/MemoEditor/index.tsx
Modified conditional rendering to display BackdatePopover when memo name is absent, replacing previous empty state.
Localization Strings
web/src/locales/en.json, web/src/locales/de.json
Added new translation keys editor.set-creation-date with English ("Set creation date") and German ("Erstellungsdatum festlegen") values.
Documentation
README.md
Added "Backdate Memos" feature bullet to describe custom creation date functionality.

Sequence Diagram(s)

sequenceDiagram
    actor User
    participant MemoEditor as MemoEditor
    participant BackdatePopover as BackdatePopover
    participant ActionDispatch as Redux/Actions

    User->>BackdatePopover: Clicks calendar icon
    BackdatePopover->>BackdatePopover: Opens popover, sets open state
    
    User->>BackdatePopover: Enters datetime value
    BackdatePopover->>BackdatePopover: Parses datetime-local string
    BackdatePopover->>BackdatePopover: Converts to Date (local time)
    BackdatePopover->>ActionDispatch: Dispatches setTimestamps({createTime: date})
    ActionDispatch->>MemoEditor: Updates memo createTime
    
    User->>BackdatePopover: Clicks clear action (X icon)
    BackdatePopover->>ActionDispatch: Dispatches setTimestamps({createTime: undefined})
    ActionDispatch->>MemoEditor: Clears createTime
    BackdatePopover->>BackdatePopover: Closes popover
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Poem

🐰 A rabbit's hoppy cheer,
For backdating memos far and near,
With calendar clicks and datetime care,
Memos can dance through time with flair! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately and concisely describes the main feature being added: the ability to set custom creation dates for new memos, enabling backdating functionality.

✏️ 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
web/src/components/MemoEditor/components/TimestampPopover.tsx (1)

143-148: Consider constraining the picker to past/current dates.

The feature is scoped as "Backdate Memos" (README, PR description), but the datetime-local input has no max attribute, so users can just as easily pick a future date. If future-dating is also an intended use case, ignore this; otherwise add max={toDatetimeLocalValue(new Date())} (refreshed on open) to match the documented intent.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/components/MemoEditor/components/TimestampPopover.tsx` around lines
143 - 148, The datetime-local input in TimestampPopover.tsx allows future dates
but this feature is scoped for backdating; add a max attribute to the input
using toDatetimeLocalValue(new Date()) so users cannot pick future timestamps
(i.e. <input ... max={toDatetimeLocalValue(new Date())} />), and ensure that
value is refreshed when the popover opens (update the max value in the handler
or a useEffect triggered by the popover open state) to keep the limit current;
reference the input element, createTime value, toDatetimeLocalValue helper and
handleDateChange in your change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@web/src/components/MemoEditor/components/TimestampPopover.tsx`:
- Around line 107-118: handleDateChange currently returns early when the
datetime-local input is emptied, leaving a stale createTime in state; update
handleDateChange to detect an empty value and dispatch actions.setTimestamps({
createTime: null }) (or undefined per existing state shape) to clear the
timestamp, otherwise continue parsing and dispatching the new Date as before so
clearing the input mirrors the explicit clear button behavior.

---

Nitpick comments:
In `@web/src/components/MemoEditor/components/TimestampPopover.tsx`:
- Around line 143-148: The datetime-local input in TimestampPopover.tsx allows
future dates but this feature is scoped for backdating; add a max attribute to
the input using toDatetimeLocalValue(new Date()) so users cannot pick future
timestamps (i.e. <input ... max={toDatetimeLocalValue(new Date())} />), and
ensure that value is refreshed when the popover opens (update the max value in
the handler or a useEffect triggered by the popover open state) to keep the
limit current; reference the input element, createTime value,
toDatetimeLocalValue helper and handleDateChange in your change.
🪄 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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: f0115d54-93c6-4cdd-97c3-8aa18c0c13db

📥 Commits

Reviewing files that changed from the base of the PR and between 587f5b1 and 658e5cd.

📒 Files selected for processing (6)
  • README.md
  • web/src/components/MemoEditor/components/TimestampPopover.tsx
  • web/src/components/MemoEditor/components/index.ts
  • web/src/components/MemoEditor/index.tsx
  • web/src/locales/de.json
  • web/src/locales/en.json

Comment on lines +107 to +118
const handleDateChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const value = e.target.value;
if (!value) return;
// Parse datetime-local value (YYYY-MM-DDTHH:mm) as local time explicitly
const [datePart, timePart] = value.split("T");
const [year, month, day] = datePart.split("-").map(Number);
const [hours, minutes] = timePart.split(":").map(Number);
const date = new Date(year, month - 1, day, hours, minutes);
if (!Number.isNaN(date.getTime())) {
dispatch(actions.setTimestamps({ createTime: date }));
}
};
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Clearing the datetime input leaves a stale createTime.

When the user clears the native datetime-local field (empty string), handleDateChange early-returns, so a previously set createTime stays in state even though the UI shows an empty picker. Expected behavior would be to clear createTime when the value is emptied (mirroring the explicit clear button).

🛠️ Suggested fix
   const handleDateChange = (e: React.ChangeEvent<HTMLInputElement>) => {
     const value = e.target.value;
-    if (!value) return;
+    if (!value) {
+      dispatch(actions.setTimestamps({ createTime: undefined }));
+      return;
+    }
     // Parse datetime-local value (YYYY-MM-DDTHH:mm) as local time explicitly
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@web/src/components/MemoEditor/components/TimestampPopover.tsx` around lines
107 - 118, handleDateChange currently returns early when the datetime-local
input is emptied, leaving a stale createTime in state; update handleDateChange
to detect an empty value and dispatch actions.setTimestamps({ createTime: null
}) (or undefined per existing state shape) to clear the timestamp, otherwise
continue parsing and dispatching the new Date as before so clearing the input
mirrors the explicit clear button behavior.

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.

2 participants