You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: update README with flexible date input documentation
- Add 'Why You Might Want to Use This Plugin' section explaining the philosophy of balancing clean code with user-friendly APIs
- Document flexible date input support for getEvents() method
- Update Dataview and Templater examples to show moment objects, Date objects, and string dates are all supported
- Address the specific Templater use case that was reported where users expected moment objects to work directly
Copy file name to clipboardExpand all lines: README.md
+42-3Lines changed: 42 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,20 @@ This is designed to work with the Daily Note or [Periodic Notes](https://github
8
8
9
9
I highly recommend pairing this with the [Day Planner](https://github.com/ivan-lednev/obsidian-day-planner) plugin: the output format is tuned to support it and you'll get support for seeing the day and week planners.
10
10
11
+
## Why You Might Want to Use This Plugin
12
+
13
+
There are many calendar integration plugins available for Obsidian, some with more features and bells and whistles. This plugin focuses on a different philosophy: **clean, maintainable code that adapts to user expectations rather than forcing users to adapt to the plugin**.
14
+
15
+
Key advantages of this approach include:
16
+
17
+
-**User-Friendly API**: The `getEvents()` method accepts date strings, moment objects, or Date objects - whatever is most natural for your use case
18
+
-**Performance Through Simplicity**: Support for vdir (local calendar cache) enables lightning-fast workflows by treating your local calendar files as a cache
19
+
-**Power User Friendly**: Designed for customization and automation through Templater and Dataview rather than trying to be everything to everyone
20
+
-**Focused Feature Set**: Does one thing well - importing calendar events into notes - rather than trying to be a full calendar management system
21
+
-**Predictable Behavior**: Clean, testable code that behaves consistently across different environments
22
+
23
+
If you value simplicity, performance, and the ability to customize your calendar integration exactly how you want it, this plugin might be a good fit for your workflow.
24
+
11
25
## Installation
12
26
13
27
This plugin is in the community plugin browser in Obsidian. Search for ICS and you can install it from there.
@@ -39,10 +53,22 @@ For customizations not available to the formatting, use Dataview or Templater (s
39
53
40
54
### Data view usage
41
55
42
-
You can also use a [Dataview](https://blacksmithgu.github.io/obsidian-dataview/) to add your events to your journal notes when they get created. For examples, if you use the core Templates plugin you can add the following to add events to your daily note template:
56
+
You can also use a [Dataview](https://blacksmithgu.github.io/obsidian-dataview/) to add your events to your journal notes when they get created.
57
+
58
+
**The `getEvents()` method accepts flexible date inputs**: date strings (like "2025-03-01" or "March 1, 2025"), moment objects, or JavaScript Date objects. This makes it easy to work with whatever date format is most convenient for your use case.
59
+
60
+
For example, if you use the core Templates plugin you can add the following to add events to your daily note template:
43
61
44
62
```dataviewjs
63
+
// Simple string-based approach
45
64
var events = await app.plugins.getPlugin('ics').getEvents(dv.current().file.name);
65
+
66
+
// Or use a Date object for today's events
67
+
var events = await app.plugins.getPlugin('ics').getEvents(new Date());
68
+
69
+
// Or use moment for date manipulation
70
+
var events = await app.plugins.getPlugin('ics').getEvents(moment().add(1, 'day'));
@@ -54,11 +80,24 @@ You can see the available fields in the [Event interface](https://github.com/clo
54
80
55
81
### Templater
56
82
57
-
Or you can use [Templater](https://github.com/SilentVoid13/Templater):
83
+
You can use [Templater](https://github.com/SilentVoid13/Templater) with flexible date inputs. The `getEvents()` method now accepts moment objects directly, so you don't need to convert them to strings:
84
+
85
+
```javascript
86
+
<%*
87
+
// Direct moment object usage (recommended)
88
+
var events =awaitapp.plugins.getPlugin('ics').getEvents(moment(tp.file.title,'YYYYMMDD'));
0 commit comments