Days Since
by gndclouds
Score: 47/100
favorite
share
Description
Category: Note Enhancements

The Days Since plugin for Obsidian adds a handy tooltip feature that tracks the number of days that have passed since a specific date. By simply hovering over a date in the format YYYY-MM-DD within your notes, users can instantly view how many days have elapsed. This tool is useful for monitoring project timelines, journal entries, or other important dates, providing an intuitive and quick way to track time directly in Obsidian without requiring additional tools.

Stats
5
stars
1,991
downloads
1
forks
325
days
231
days
231
days
0
total PRs
0
open PRs
0
closed PRs
0
merged PRs
1
total issues
0
open issues
1
closed issues
7
commits
Latest Version
8 months ago
Changelog

New Features

  • Tooltip for Dates: Added functionality to display a tooltip showing the number of days since a date when hovering over file names or selecting text within files. The tooltip appears only if a valid date format is detected.
  • File Viewer Integration: Tooltip functionality is now integrated with the file viewer, providing dynamic date information when hovering over file names.
  • Theme Matching: Tooltip styling now matches the active Obsidian theme, ensuring consistent look and feel.

Enhancements

  • Improved Tooltip Readability: Added a border and a light shadow to the tooltip to enhance readability and contrast.
  • Selection Handling: Tooltip displays only when a single date or a date with one space on either side is selected, preventing false positives when large chunks of text are selected.

Bug Fixes

  • Error Handling: Fixed an issue where getRangeAt would throw a DOMException when called on an empty selection.
  • CSS Injection: Resolved Content Security Policy (CSP) restrictions by injecting CSS styles directly into the document head, ensuring compatibility with Obsidian's security settings.

Detailed Changes

  • Added handleSelection method to display the tooltip based on text selection.
  • Added handleHover method to display the tooltip based on hovering over file names in the file viewer.
  • Added injectStyles method to inject CSS styles directly into the document head, avoiding CSP issues.
  • Improved tooltip styling with added border and box shadow for better contrast and readability.
  • Ensured tooltip functionality only triggers for exact date selections or file names within the file viewer.

(Integrated into main.ts) Added styles for .plugin-tooltip to match the active Obsidian theme and improve tooltip readability.

How to Use

  • Hover Over File Names: Hover over file names in the file viewer to see a tooltip showing the number of days since the date in the file name.
  • Select Text: Select a date or a date with one space on either side within a file to see the tooltip with the number of days since the selected date.
README file from