quickadd icon indicating copy to clipboard operation
quickadd copied to clipboard

feat: enable VDATE reuse with different formats

Open chhoumann opened this issue 6 months ago • 1 comments

Summary

Implemented the ability to reuse VDATE variables with different date formats. Users can now enter a date once and format it multiple times in different ways within the same template.

Problem Solved

Previously, VDATE would store the formatted date string, preventing reuse with different formats. Users had to enter the same date multiple times if they needed it in different formats (e.g., for hierarchical folder structures).

Solution

  • Store the parsed date as an ISO string with a special @date: prefix
  • Format the date on-demand when referenced
  • Maintain backward compatibility for existing templates

Example Usage

{{VDATE:date,YYYY}}/{{VDATE:date,MM}}/{{VDATE:date,DD}}/{{VDATE:date,YYYY-MM-DD}}.md

Enter "today" once, get: 2024/01/15/2024-01-15.md

Use Cases

  1. Hierarchical folder structures: Organize notes by year/month/day
  2. Consistent date formatting: Use same date in filename and content
  3. Meeting notes: Show both formal date and day name
  4. Natural language benefits: Enter "next week" once, use everywhere

Technical Details

  • Dates are stored as @date:2024-01-15T00:00:00.000Z in the variables map
  • The @date: prefix identifies values that need date formatting
  • Non-prefixed values are used as-is for backward compatibility
  • Uses moment.js for date parsing and formatting (via Natural Language Dates plugin)

Testing

  • [x] TypeScript compilation successful
  • [x] Manual testing with various date formats
  • [x] Tested natural language inputs
  • [x] Verified backward compatibility

Benefits

  • Single input: Enter date once, format many ways
  • Flexibility: Any moment.js format works
  • Natural language: "today", "next week", etc. work across all uses
  • Future-proof: Enables date arithmetic features later (#819)

Fixes #69

🤖 Generated with Claude Code

chhoumann avatar May 30 '25 10:05 chhoumann

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
quickadd ✅ Ready (Inspect) Visit Preview Jun 19, 2025 3:15pm

vercel[bot] avatar May 30 '25 10:05 vercel[bot]

:tada: This PR is included in version 1.14.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

github-actions[bot] avatar Jun 19 '25 15:06 github-actions[bot]

🚀 Release has been published: v1.14.0

github-actions[bot] avatar Jun 19 '25 15:06 github-actions[bot]